From dd5d759cd026b649c565b4ea804897bc127fd997 Mon Sep 17 00:00:00 2001 From: Roman Solomatin <36135455+Samoed@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:45:37 +0300 Subject: [PATCH 1/2] update script --- .../workflows/model-results-comparison.yaml | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/model-results-comparison.yaml b/.github/workflows/model-results-comparison.yaml index 8405521810..b05c578dd3 100644 --- a/.github/workflows/model-results-comparison.yaml +++ b/.github/workflows/model-results-comparison.yaml @@ -1,7 +1,7 @@ name: Model Results Comparison on: - pull_request: + pull_request_target: # Changed from pull_request types: [opened, synchronize, edited] paths: - 'results/**/*.json' @@ -14,7 +14,7 @@ on: default: 'intfloat/multilingual-e5-large google/gemini-embedding-001' pull_request_number: description: 'The pull request number to comment on (required if triggered manually)' - required: false # Make it not strictly required if you want to run it without a PR context for other reasons + required: false type: string permissions: @@ -29,6 +29,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: + # IMPORTANT: For pull_request_target, check out the PR branch explicitly + ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 - name: Fetch origin main @@ -49,10 +51,16 @@ jobs: run: | python scripts/create_pr_results_comment.py --reference-models $REFERENCE_MODELS --output model-comparison.md + - name: Upload comparison report + uses: actions/upload-artifact@v4 + with: + name: model-comparison + path: model-comparison.md + - name: Determine PR Number id: pr_info run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then + if [ "${{ github.event_name }}" == "pull_request_target" ]; then echo "pr_number=${{ github.event.number }}" >> $GITHUB_OUTPUT elif [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.pull_request_number }}" ]; then echo "pr_number=${{ github.event.inputs.pull_request_number }}" >> $GITHUB_OUTPUT @@ -61,14 +69,7 @@ jobs: fi - name: Post PR comment - # This step will run if a PR number is available either from the PR event or workflow_dispatch input if: steps.pr_info.outputs.pr_number != '' env: GITHUB_TOKEN: ${{ github.token }} run: gh pr comment ${{ steps.pr_info.outputs.pr_number }} --body-file model-comparison.md --create-if-none --edit-last - - - name: Upload comparison report - uses: actions/upload-artifact@v4 - with: - name: model-comparison - path: model-comparison.md From c81c0e16e49caf93680adcc0b17c2b1a4db81f62 Mon Sep 17 00:00:00 2001 From: Roman Solomatin <36135455+Samoed@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:47:22 +0300 Subject: [PATCH 2/2] remove comment --- .github/workflows/model-results-comparison.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/model-results-comparison.yaml b/.github/workflows/model-results-comparison.yaml index b05c578dd3..a259d9d473 100644 --- a/.github/workflows/model-results-comparison.yaml +++ b/.github/workflows/model-results-comparison.yaml @@ -1,7 +1,7 @@ name: Model Results Comparison on: - pull_request_target: # Changed from pull_request + pull_request_target: types: [opened, synchronize, edited] paths: - 'results/**/*.json'