Skip to content

Commit dd2258b

Browse files
committed
fix: use GitHub Status API to report test status for changeset PRs
The workflow was incorrectly assuming that using the job name "test" would satisfy the required status check. However, GitHub Actions workflow runs create Check Runs (not Commit Statuses) with context "workflow-name / job-name", not just the job name. This fix uses the GitHub Status API to explicitly create a commit status with context "test" to satisfy the branch protection rule.
1 parent 7845d2a commit dd2258b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/changeset-pr-check.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# Solution:
1212
# - Use pull_request_target which runs even for bot-created PRs
13-
# - Use the same job name "test" to satisfy the required status check
13+
# - Use GitHub Status API to create the exact "test" status context
1414
# - Only runs for PRs titled "chore: version packages"
1515
# ============================================================================
1616

@@ -25,16 +25,24 @@ on:
2525
branches: [main]
2626

2727
jobs:
28-
test:
29-
name: test
28+
changeset-check:
29+
name: Changeset PR Check
3030
runs-on: ubuntu-latest
3131
# Only run for changeset PRs (identified by title)
3232
if: github.event.pull_request.title == 'chore: version packages'
3333

3434
steps:
35-
- name: Skip tests for version packages PR
36-
run: |
37-
echo "✅ Skipping tests - changeset PR only changes version numbers"
38-
echo ""
39-
echo "This PR was created by the changesets automation and only"
40-
echo "updates package versions and changelogs. No code tests needed."
35+
- name: Report test status for changeset PR
36+
uses: actions/github-script@v7
37+
with:
38+
script: |
39+
// Create a commit status with context "test" to satisfy branch protection
40+
await github.rest.repos.createCommitStatus({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
sha: context.payload.pull_request.head.sha,
44+
state: 'success',
45+
context: 'test',
46+
description: 'Skipped - changeset PR only updates versions'
47+
});
48+
console.log('✅ Reported "test" status as success for changeset PR');

0 commit comments

Comments
 (0)