Skip to content

Commit 5ba5d24

Browse files
authored
fix(ci): skip pull request automation without write credentials (#72)
* fix(ci): skip changeset hygiene without comment permissions * fix(ci): skip project board updates without app credentials
1 parent 9c9ec54 commit 5ba5d24

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/changeset-hygiene.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ permissions:
1515

1616
jobs:
1717
check:
18+
# Fork and Dependabot PR tokens are read-only, so they cannot upsert the report comment.
19+
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
1820
name: Check changeset hygiene
1921
runs-on: ubuntu-latest
2022
timeout-minutes: 10

.github/workflows/flags-project-board.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ jobs:
7373
# the github.event_name is supposed to be `workflow_call`, but because this workflow lives in the special `.github` repository,
7474
# it preserves the original event name (e.g. pull_request).
7575
# This is a not well-documented special case.
76-
# Dependabot-triggered runs execute in a restricted secret context with no
77-
# access to PROJECT_BOARD_BOT_APP_ID / PRIVATE_KEY, so the token step below
78-
# hard-fails because the client ID is empty on every dependency-bump
79-
# PR. Skip them — dependency bumps don't belong on the feature flags board.
80-
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'pull_request_review') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
76+
# Fork and Dependabot PRs run without the GitHub App credentials required below.
77+
# On pull_request_review, github.actor is the reviewer, so inspect the PR author instead.
78+
if: >-
79+
github.event_name == 'workflow_dispatch' ||
80+
((github.event_name == 'pull_request' || github.event_name == 'pull_request_review') &&
81+
github.event.pull_request.head.repo.full_name == github.repository &&
82+
github.event.pull_request.user.login != 'dependabot[bot]')
8183
steps:
8284
- name: Generate GitHub App Token
8385
id: app-token

0 commit comments

Comments
 (0)