Skip to content

Commit bc2eb75

Browse files
ci(test): skip test-trigger-other-job when token is read-only
The test-trigger-other-job job runs `gh workflow run`, which requires `actions: write` on the GITHUB_TOKEN. The job has been failing on: - Fork PRs (e.g. contributor PRs from forks): fork-originated PRs always receive a read-only GITHUB_TOKEN. - Dependabot PRs (e.g. #15): even though dependabot creates branches in the same repo, the dependabot[bot] actor receives a restricted token by default. Both produce: could not create workflow dispatch event: HTTP 403: Resource not accessible by integration Skip this job in both cases by gating on `head.repo.full_name` and on `github.actor`. The job continues to run on PRs from same-repo branches authored by humans, where the token has the required permissions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7247d00 commit bc2eb75

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ jobs:
8181
assert.ok(changelogContent.includes('### Fix'), 'Expected changelog to contain a header for fixes');
8282
test-trigger-other-job:
8383
runs-on: ubuntu-latest
84+
# Skip when the token will be read-only and `gh workflow run` would
85+
# fail with HTTP 403 ("Resource not accessible by integration"):
86+
# - Fork PRs: GITHUB_TOKEN is always read-only on fork-originated PRs.
87+
# - Dependabot PRs: even though the branch is in the same repo, the
88+
# dependabot[bot] actor receives a restricted token by default.
89+
if: >-
90+
github.event.pull_request.head.repo.full_name == github.repository &&
91+
github.actor != 'dependabot[bot]'
8492
steps:
8593
- uses: actions/checkout@v6
8694
with:

0 commit comments

Comments
 (0)