ci(github): use app token for dependabot merges#78
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Dependabot auto-merge workflow to approve and enable auto-merge using a GitHub App installation token (instead of GITHUB_TOKEN), so downstream workflows can run after Dependabot merges land on main.
Changes:
- Adds a SHA-pinned
actions/create-github-app-tokenstep gated to semver patch/minor updates. - Uses the generated App token as
GH_TOKENforgh pr review --approveandgh pr merge --auto --squash. - Leaves
dependabot/fetch-metadatausing the defaultGITHUB_TOKEN.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73b76cb80a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| app-id: ${{ secrets.DEPENDABOT_AUTOMERGE_APP_ID }} | ||
| private-key: ${{ secrets.DEPENDABOT_AUTOMERGE_PRIVATE_KEY }} |
There was a problem hiding this comment.
Use a trigger that can receive the app credentials
Because this job is restricted to Dependabot-authored pull_request_target runs, GitHub does not expose configured secrets in this context (GitHub docs). That means semver patch/minor Dependabot PRs will reach actions/create-github-app-token with empty app-id/private-key inputs, so the approval and auto-merge steps never run; use an event/secret setup that is available to Dependabot before switching these steps to the app token.
Useful? React with 👍 / 👎.
| - name: Generate app token | ||
| id: app-token | ||
| if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' | ||
| uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 |
Summary
Updates the Dependabot auto-merge workflow to use the LayeredCraft GitHub App token for approving and enabling auto-merge. This avoids using
GITHUB_TOKENfor the merge operation so downstream workflows can run after Dependabot auto-merged changes land onmain.Changes
actions/create-github-app-tokenstep for semver patch/minor Dependabot PRs.GH_TOKENforgh pr review --approveandgh pr merge --auto --squash.dependabot/fetch-metadataon the defaultGITHUB_TOKEN.Validation
Notes for Reviewers
Requires the Actions secrets
DEPENDABOT_AUTOMERGE_APP_IDandDEPENDABOT_AUTOMERGE_PRIVATE_KEYto be available to this repository.