Commit 0340d0c
ci(port): open port PRs with a GitHub App so their checks actually count
Branch protection on main requires six status checks, and only pull_request-event
runs satisfy them. GitHub does not trigger workflows from events created with the
native GITHUB_TOKEN (recursion guard), so a PR opened with it gets no
pull_request checks and can never become mergeable — the automated port PR would
sit permanently stuck.
The previous workaround dispatched ci.yaml at the PR branch. That does not work,
and I measured it rather than assuming: on PR #24 the commit carried 14
check-runs while the PR's rollup showed 7. A workflow_dispatch run of the same
workflow, on the same commit, succeeding, was entirely invisible to branch
protection.
(I also had to correct myself here. I first claimed dispatch runs never attach,
citing runs on LukasParke/e2e-CI — but that PR was already merged and closed when
they ran, so nothing would have shown regardless. Retested on an open PR: 7 checks
before the dispatch, 7 after. Same conclusion, real evidence.)
Also verified that dropping the PR requirement does not help. On a throwaway
protected branch with required checks and no PR requirement, a direct push is
rejected outright:
remote: error: GH006: Protected branch update failed
remote: - Required status check "types" is expected.
Required checks gate pushes too, so there is no configuration of branch
protection that lets GITHUB_TOKEN-created work through while keeping the gates.
An App installation token is not recursion-guarded, so the PR it opens gets real
checks. Preferred over a PAT: scoped to this repo, not tied to a personal account,
revocable on its own.
- New "Mint App token" step (actions/create-github-app-token@v1), gated on
vars.PORT_BOT_APP_ID being set.
- create-pull-request uses the App token when present, GITHUB_TOKEN otherwise.
- The dispatch step is now a FALLBACK, running only when no App token was minted,
and it emits a ::warning:: stating plainly that the PR will get no checks and
cannot merge as-is. An unconfigured bot should degrade loudly rather than look
healthy while producing permanently stuck PRs.
Setup is documented in PORTING.md: App with Contents + Pull requests read/write
(nothing else), installed on this repo, then PORT_BOT_APP_ID (variable) and
PORT_BOT_PRIVATE_KEY (secret). Neither exists yet, so the fallback path is what
runs until they are added.
Verification: all three workflows parse · mint step gated correctly · PR token
falls back as intended · verify.sh PASS (0 failures) · 114 passed.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent ce2b239 commit 0340d0c
2 files changed
Lines changed: 82 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
145 | 170 | | |
146 | 171 | | |
147 | 172 | | |
148 | 173 | | |
149 | 174 | | |
150 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
151 | 179 | | |
152 | 180 | | |
153 | 181 | | |
| |||
172 | 200 | | |
173 | 201 | | |
174 | 202 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
182 | 215 | | |
183 | 216 | | |
184 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
185 | 220 | | |
186 | 221 | | |
187 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
135 | 172 | | |
136 | 173 | | |
137 | 174 | | |
| |||
0 commit comments