Skip to content

Commit 6b39675

Browse files
fix(ci): add gate job for stable test / Test status check
Add a gate job that runs after all other jobs complete to provide a stable 'test / Test' status check name for branch protection. The previous approach using workflow_run doesn't create status checks on PR commits - it only runs on the default branch context.
1 parent 02f4531 commit 6b39675

2 files changed

Lines changed: 17 additions & 28 deletions

File tree

.github/workflows/build-and-test.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,12 @@ jobs:
201201
packages/wasm-utxo/pkg/
202202
packages/wasm-utxo/dist/
203203
retention-days: 1
204+
205+
# This job provides a stable "test / Test" status check for branch protection.
206+
# It runs after all other jobs complete successfully.
207+
gate:
208+
name: "Test"
209+
needs: [build, test, finalize]
210+
runs-on: ubuntu-latest
211+
steps:
212+
- run: echo "All checks passed"

.github/workflows/status-check.yaml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,22 @@
33
# avoiding the multi-level name composition that occurs with reusable workflows.
44
# Configure branch protection rules to require "test / Test" as the status check.
55

6-
name: "test"
6+
name: "test / Test"
77

88
on:
99
workflow_run:
1010
workflows: ["Build and Test"]
1111
types:
1212
- completed
1313

14-
permissions:
15-
statuses: write
16-
1714
jobs:
1815
status:
19-
name: "Test"
2016
runs-on: ubuntu-latest
2117
steps:
22-
- name: Set commit status
23-
uses: actions/github-script@v7
24-
with:
25-
script: |
26-
const { owner, repo } = context.repo;
27-
const sha = context.payload.workflow_run.head_sha;
28-
const conclusion = context.payload.workflow_run.conclusion;
29-
const runUrl = context.payload.workflow_run.html_url;
30-
31-
const state = conclusion === 'success' ? 'success' :
32-
conclusion === 'failure' ? 'failure' :
33-
conclusion === 'cancelled' ? 'failure' : 'error';
34-
35-
await github.rest.repos.createCommitStatus({
36-
owner,
37-
repo,
38-
sha,
39-
state,
40-
target_url: runUrl,
41-
description: `Build and Test ${conclusion}`,
42-
context: 'test / Test'
43-
});
44-
18+
- name: Check Build and Test Status
19+
run: |
20+
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then
21+
echo "Build and Test workflow failed"
22+
exit 1
23+
fi
24+
echo "Build and Test workflow succeeded"

0 commit comments

Comments
 (0)