Skip to content

ci: let a GitHub App merge Dependabot PRs and add update cooldown - #2226

Merged
martin-helmich merged 1 commit into
masterfrom
ci/dependabot-app-merge
Nov 18, 2026
Merged

martin-helmich merged 1 commit into
masterfrom
ci/dependabot-app-merge

Conversation

@martin-helmich

@martin-helmich martin-helmich commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

GitHub Actions may no longer approve pull requests in this organization, so automerge.yml cannot approve Dependabot PRs any more. This PR moves merging Dependabot PRs to a dedicated GitHub App and hardens the setup around it.

Update cooldown

Dependabot now only proposes versions that have been public for 7 days, for npm and GitHub Actions. Compromised releases (stolen maintainer tokens, npm worms) usually ship as patch versions and get yanked within hours or days; since patch updates are merged and released automatically, they must not arrive the same day. @mittwald/api-client is excluded. Security updates are not affected by the cooldown.

One workflow merges Dependabot PRs

review-dependabot-prs.yml becomes the only workflow that merges Dependabot PRs; automerge.yml is removed. It sorts open Dependabot PRs by the metadata in Dependabot's commit:

  • Fast track (same rules as automerge.yml): patch updates, the mittwald-api group, minor updates of development dependencies. These are merged as soon as the required checks pass, without an agent review.
  • Agent review: all other minor and major updates, as before.

review-dependabot-pr.yml gets a fast-track input that skips the review job.

GitHub App instead of MACHINE_USER_TOKEN

The apply job uses a short-lived token of the dependency app, limited to the permissions it needs and passed only to the steps that need it (not to the npx prettier step). Checkout no longer persists git credentials.

The app bypasses the master ruleset for pull requests. That skips the required review and the required status checks, so the apply job:

  • waits for the required checks itself before merging,
  • only bypasses the review for commits signed by Dependabot (author dependabot[bot], verified by GitHub), commits it pushed itself, and commits that only touch README.md or docs/*.md; merge commits or anything else escalate the PR,
  • merges without the bypass when a maintainer approved the PR, so GitHub enforces the ruleset.

Both jobs refuse PRs that are not authored by Dependabot in this repository, including manual dispatches. Fast-tracked PRs that cannot be merged yet (conflicts, moving head) are retried on the next run instead of being escalated; failed checks or unexpected commits escalate them.

Environments

  • dependency-updates (master only): the app's credentials, used by the apply job.
  • ai-agents (master and v* tags): MITTWALD_AI_API_KEY, used by the review job and the release announcement.

The review job runs the dependency's code and never gets the app's key. Environment secrets cannot be passed through workflow_call, so the jobs reference the environments themselves.

🤖 Generated with Claude Code

Dependabot now holds back new versions for 7 days (except
@mittwald/api-client), so compromised releases, which usually ship as
patch versions and get yanked within days, are not merged and released
automatically on the day they appear.

review-dependabot-prs.yml becomes the only workflow that merges
Dependabot PRs, replacing automerge.yml, which can no longer approve
PRs since GitHub Actions may not approve PRs in this organization.
Patch updates, the mittwald-api group and minor updates of development
dependencies are fast-tracked; everything else is reviewed by the agent
first.

Merges use a token of the dependency GitHub App instead of
MACHINE_USER_TOKEN. The app bypasses the master ruleset for pull
requests, which skips the required review and status checks, so the
workflow waits for the checks itself and only bypasses the review for
commits signed by Dependabot, commits it pushed itself, and commits
that only touch the generated docs.

The app's credentials and MITTWALD_AI_API_KEY move to the
"dependency-updates" and "ai-agents" environments, so that workflows on
other branches cannot read them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martin-helmich
martin-helmich merged commit cc41436 into master Nov 18, 2026
8 checks passed
@martin-helmich
martin-helmich deleted the ci/dependabot-app-merge branch November 18, 2026 07:27
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