Skip to content

dependabot-auto-merge: optional App token, fail-closed update-type gate - #19

Merged
lucas-d-ramos merged 1 commit into
mainfrom
feat/auto-merge-app-token
Aug 20, 2026
Merged

dependabot-auto-merge: optional App token, fail-closed update-type gate#19
lucas-d-ramos merged 1 commit into
mainfrom
feat/auto-merge-app-token

Conversation

@lucas-d-ramos

Copy link
Copy Markdown
Contributor

Unblocks the org-wide Dependabot policy work: this is the one change that
re-arms auto-merge everywhere, since all six consumers already pin @v14.

Why

A merge armed with GITHUB_TOKEN has its push event suppressed by GitHub's
recursion guard, so a repo whose deploy runs on: push to the default branch
builds nothing for that merge. The PR goes green and nothing ships.

Measured across the org on 2026-08-20 — commits sitting on main with no
corresponding deploy run:

Repo Undeployed commits Last real deploy
youmove 41 2026-07-10
wemove-charity.eu 40 2026-07-10
bankimporter 32 2026-06-21
mep-data-manager 28 2026-07-06
toolbox 22 2026-07-12
pubstatic 8 2026-07-30
ecm 6 2026-06-23
analytics 4
wemove.eu 3 2026-08-17

Control case: on wemove.eu the two human pushes on 2026-08-17 both
triggered publish.yml; the three Dependabot merges after them triggered
nothing. Every merged Dependabot PR shows mergedBy: app/github-actions.

What changed

Optional App credentials. New app-id / app-private-key secrets mint an
installation token, whose merge emits a real push event. Both are optional and
fall back to GITHUB_TOKEN, so existing callers keep working unchanged — the
workflow just warns in the run log when it falls back. Additive, hence v14.1.0
rather than a new major.

Fail-closed update-type gate. contains(allowed, update-type) returned
true whenever fetch-metadata produced no update-type, because every string
contains the empty string — which would auto-merge a major. Now matches whole
tokens and requires a non-empty update-type, the same stance donation-form and
donations-api already take.

This second one is not theoretical: dependabot.yml ignore rules cover
version updates only, so a security major does reach this workflow, and
this gate is the only thing refusing it.

Consuming this

The App needs Contents, Pull requests and Workflows (read/write). Workflows
is easy to miss and not optional — Dependabot's github-actions PRs edit files
under .github/workflows/, and a token without it is refused when merging them.

Rollback

Move the floating v14 tag back to 022a3ed. Instant and org-wide.

🤖 Generated with Claude Code

Auto-merge armed with GITHUB_TOKEN lands with its push event suppressed
(GitHub's recursion guard), so a repo whose deploy runs `on: push` to the
default branch builds nothing for that merge. Surveyed across the org on
2026-08-20: nine repos had silently accumulated undeployed commits on main
this way — youmove 41, wemove-charity.eu 40, bankimporter 32,
mep-data-manager 28, toolbox 22 — every one merged by app/github-actions.

Accept optional `app-id` / `app-private-key` secrets and arm the merge with
an App installation token instead, which emits a real push event. The
secrets are optional and fall back to GITHUB_TOKEN, so existing callers are
unaffected; the workflow warns in the run log when it falls back.

Also make the update-type gate fail closed. `contains(allowed, update-type)`
returned true whenever fetch-metadata produced no update-type, because every
string contains the empty string — which would auto-merge a major. Match
whole tokens and require a non-empty update-type, the same stance
donation-form and donations-api take. This matters because dependabot.yml
`ignore` rules cover version updates only: a security major does reach this
workflow, and this gate is the only thing refusing it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lucas-d-ramos
lucas-d-ramos merged commit 923dbad into main Aug 20, 2026
1 check passed
@lucas-d-ramos
lucas-d-ramos deleted the feat/auto-merge-app-token branch August 20, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant