File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed
Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change 88jobs :
99 finalize :
1010 runs-on : ubuntu-latest
11+ if : ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_sha == github.sha }}
12+ # Needed for listWorkflowRunsForRepo and safe defaults for token scope
13+ permissions :
14+ actions : read
15+ contents : read
16+ workflows : write
17+ # Prevent multiple concurrent finalizers for the same commit
18+ concurrency :
19+ group : coverage-${{ github.event.workflow_run.head_sha }}
20+ cancel-in-progress : true
1121 steps :
12- - uses : actions/github-script@v7
22+ - id : check
23+ uses : actions/github-script@v7
1324 with :
1425 script : |
1526 const workflows = await github.rest.actions.listWorkflowRunsForRepo({
1627 owner: context.repo.owner,
1728 repo: context.repo.repo,
1829 head_sha: context.payload.workflow_run.head_sha,
19- status: 'completed'
30+ status: 'completed',
31+ per_page: 100
2032 });
2133
2234 const bothComplete = ['Integration Tests', 'Unit Tests'].every(name =>
23- workflows.data.workflow_runs.some(run => run.name === name)
35+ workflows.data.workflow_runs.some(
36+ run => run.name === name && run.conclusion === 'success'
37+ )
2438 );
2539
26- if (!bothComplete) {
27- core.info('Waiting for other workflow to complete');
28- process.exit(0);
29- }
40+ core.info(bothComplete ? 'Both workflows completed successfully.' : 'Waiting for other workflow to complete.');
41+ core.setOutput('ready', String(bothComplete));
3042
31- - uses : coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
43+ - if : ${{ steps.check.outputs.ready == 'true' }}
44+ uses : coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
3245 with :
3346 github-token : ${{ secrets.GITHUB_TOKEN }}
3447 parallel-finished : true
You can’t perform that action at this time.
0 commit comments