Skip to content

Commit e3549e3

Browse files
authored
ci/publishing: Use afterall action (#3126)
Signed-off-by: Ryan Northey <[email protected]>
1 parent bf09e91 commit e3549e3

File tree

1 file changed

+10
-43
lines changed

1 file changed

+10
-43
lines changed

.github/workflows/_publish.yml

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,27 @@ jobs:
2424
if: ${{ inputs.conclusion == 'success' }}
2525
runs-on: ubuntu-24.04
2626
steps:
27-
- name: Check Status of All Workflows
28-
uses: actions/github-script@v7
29-
id: check_all
27+
- name: Check all workflows ran
28+
id: afterall
29+
uses: envoyproxy/toolshed/gh-actions/github/afterall@bf09e91fd215754df30e54a293983484845465ca
3030
with:
31-
script: |
32-
const requiredWorkflows = ["Bazel CI", "Rust CI"];
33-
const currentSha = "${{ inputs.sha }}";
34-
const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
head_sha: currentSha,
38-
per_page: 100
39-
});
40-
let allFinished = true;
41-
let runIds = {};
42-
for (const name of requiredWorkflows) {
43-
const workflowRun = runs.workflow_runs.find(r => r.name === name);
44-
if (!workflowRun) {
45-
console.log(`Workflow ${name} has not started for this commit yet.`);
46-
allFinished = false;
47-
break;
48-
}
49-
if (workflowRun.status !== 'completed' || workflowRun.conclusion !== 'success') {
50-
console.log(`Workflow ${name} is ${workflowRun.status} with conclusion ${workflowRun.conclusion}.`);
51-
allFinished = false;
52-
break;
53-
}
54-
runIds[name] = workflowRun.id;
55-
}
56-
57-
if (!allFinished) {
58-
console.log("Not all workflows are complete/successful. Stopping.");
59-
return "STOP";
60-
}
61-
console.log("All workflows passed! Proceeding.");
62-
return runIds;
63-
31+
sha: ${{ inputs.sha }}
32+
workflows: ${{ inputs.workflows }}
6433
- name: Download Artifacts (Bazel CI)
65-
if: ${{ steps.check_all.outputs.result != '"STOP"' }}
34+
if: ${{ fromJSON(steps.afterall.outputs.continue) }}
6635
uses: actions/download-artifact@v4
6736
with:
68-
run-id: ${{ fromJson(steps.check_all.outputs.result)['Bazel CI'] }}
69-
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
run-id: ${{ fromJSON(steps.afterall.outputs.run-ids)['Bazel CI'] }}
7038
path: ./artifacts/bazel
7139
- name: Download Artifacts (Rust CI)
72-
if: ${{ steps.check_all.outputs.result != '"STOP"' }}
40+
if: ${{ fromJSON(steps.afterall.outputs.continue) }}
7341
uses: actions/download-artifact@v4
7442
with:
75-
run-id: ${{ fromJson(steps.check_all.outputs.result)['Rust CI'] }}
76-
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
run-id: ${{ fromJSON(steps.afterall.outputs.run-ids)['Rust CI'] }}
7744
path: ./artifacts/rust
7845

7946
- name: Publish / Release
80-
if: ${{ steps.check_all.outputs.result != '"STOP"' }}
47+
if: ${{ fromJSON(steps.afterall.outputs.continue) }}
8148
run: |
8249
echo "Deploying artifacts..."
8350
mkdir -p artifacts

0 commit comments

Comments
 (0)