Skip to content

Enable Dependabot auto-merge with a GitHub App token - #90

Draft
maks-rafalko wants to merge 1 commit into
masterfrom
fix/dependabot-automerge-app-token
Draft

maks-rafalko wants to merge 1 commit into
masterfrom
fix/dependabot-automerge-app-token

Conversation

@maks-rafalko

Copy link
Copy Markdown
Member

Dependabot PRs keep getting removed from the merge queue with no response for status checks (e.g. #89, and the first two attempts on #88).

The cause is that auto-merge is enabled with GITHUB_TOKEN, so the merge queue entry is created by github-actions. GitHub does not start workflow runs for events caused by GITHUB_TOKEN, so no merge_group run of CI starts and the required checks never report. When #88 was queued manually, CI ran and it merged within a minute.

This switches the job to a GitHub App installation token (actions/create-github-app-token), whose events do trigger workflows.

Required before merging: a GitHub App installed on this repo with Contents: write and Pull requests: write, and its ID and private key added as Dependabot secrets AUTOMERGE_APP_ID and AUTOMERGE_APP_PRIVATE_KEY. Dependabot-triggered runs can't read Actions secrets.

PRs queued by GITHUB_TOKEN never get a merge_group CI run, so the merge
queue removes them with "no response for status checks".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@theofidry theofidry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maks-rafalko maybe it would be better to generate a dedicated token with restricted permissions and configure the latter as an environment variable? Or a dedicated App (for which the token can be more short-lived)?

This also means double checking the cooldowns + max age time of all updated deps as otherwise this workflows means:

  • one can merge a malicious package
  • can have code from the malicious package minting tokens (and here you generate a token with a certain level of permissions)

I'm not well versed enough to fully measure the risk or capabilities but it does sound quite risky.

@maks-rafalko

Copy link
Copy Markdown
Member Author

maybe it would be better to generate a dedicated token with restricted permissions and configure the latter as an environment variable? Or a dedicated App (for which the token can be more short-lived)?

I am yet to discover the best option for merge queue, but it looks like there are 2 official recommendations: to use the GH app or a personal token (PAT), which expires. I think it will be the app with limited access to this repo only, but I didn't analyse it yet (it's draft).

This also means double checking the cooldowns + max age time of all updated deps as otherwise this workflows means:

cool down is ok. I just want to say that I still review all the PRs even if they are merged.

And nothing is being deployed automatically here. So the risk is practically ~0.

What I want to achieve is to automate the boring staff, not removing the human review.

@theofidry

Copy link
Copy Markdown
Member

And nothing is being deployed automatically here. So the risk is practically ~0.

Depends what they get access from by minting the token + if someone's machine gets corrupted form having it locally.

What I want to achieve is to automate the boring staff, not removing the human review.

I sympathise with the goal, I just wanted to point out potential risks – especially given the last year and last October in particular, crazy rate of security issues and malware and account takeovers.

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.

2 participants