44 pull_request_target :
55 workflow_run :
66 workflows : ['Run tests for PR']
7- types : [requested, completed]
7+ types : [completed]
88
99concurrency :
10- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}
10+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch }}
1111 cancel-in-progress : true
1212
1313jobs :
14+ restore-pr :
15+ if : github.event_name == 'workflow_run'
16+ runs-on : ubuntu-latest
17+ outputs :
18+ pr-number : ${{ steps.pr-info.outputs.pr-number }}
19+ steps :
20+ - name : Download PR info
21+ uses : dawidd6/action-download-artifact@v6
22+ with :
23+ name : pr_number
24+ path : pr/
25+ run_id : ${{ github.event.workflow_run.id }}
26+ - name : Store PR number
27+ id : pr-info
28+ run : echo "pr-number=$(cat pr/pr_number)" >> $GITHUB_OUTPUT
1429 reviewdog :
1530 if : github.event_name == 'workflow_run'
31+ needs :
32+ - restore-pr
1633 strategy :
1734 matrix :
1835 include :
2643 steps :
2744 - name : ' Checkout Repository'
2845 uses : actions/checkout@v4
29- - run : echo "${{ toJson(github.event) }}"
30- - name : Download benchmark results
46+ - name : Download style reports
3147 uses : dawidd6/action-download-artifact@v6
3248 with :
3349 name : style-reports
@@ -40,10 +56,10 @@ jobs:
4056 - name : Run reviewdog ${{ matrix.tool }}
4157 env :
4258 REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43- CI_PULL_REQUEST : ${{ github.event.workflow_run.pull_requests[0]. number }}
59+ CI_PULL_REQUEST : ${{ needs.restore-pr.outputs.pr- number }}
4460 CI_REPO_OWNER : ${{ github.repository_owner }}
4561 CI_REPO_NAME : ${{ github.event.repository.name }}
46- CI_COMMIT : ${{ github.event.workflow_run.pull_requests[0].head.sha }}
62+ CI_COMMIT : ${{ github.event.workflow_run.head_sha }}
4763 run : echo reports/${{ matrix.tool }}-reviewdog.out | reviewdog -tee -reporter=github-pr-review -name=${{ matrix.tool }} -efm="${{ matrix.error-format }}"
4864 danger-check :
4965 if : github.event_name == 'pull_request_target'
6480 upload-coverage :
6581 runs-on : ubuntu-latest
6682 if : github.event.workflow_run.actor.name != 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success'
83+ needs :
84+ - restore-pr
6785 steps :
6886 - name : ' Checkout Repository'
6987 uses : actions/checkout@v4
7997 - name : Upload coverage reports to Codecov
8098 uses : codecov/codecov-action@v4
8199 with :
82- override_branch : ${{ github.event.workflow_run.pull_requests[0].head.ref }}
83- override_commit : ${{ github.event.workflow_run.pull_requests[0].head.sha }}
84- override_pr : ${{ github.event.workflow_run.pull_requests[0]. number }}
100+ override_branch : ${{ github.event.workflow_run.head_branch }}
101+ override_commit : ${{ github.event.workflow_run.head_sha }}
102+ override_pr : ${{ needs.restore-pr.outputs.pr- number }}
85103 token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments