ci: harden dependabot-tidy workflow to allow auto-triggering CI - #602
Open
BjoernKarma wants to merge 1 commit into
Open
ci: harden dependabot-tidy workflow to allow auto-triggering CI#602BjoernKarma wants to merge 1 commit into
BjoernKarma wants to merge 1 commit into
Conversation
stefan-ctrl
approved these changes
Aug 19, 2026
stefan-ctrl
left a comment
Member
There was a problem hiding this comment.
LGTM. Has harding to prevent go mod tidy jobs overwrite other stuff and generally prevent escalation.
Should try it out, if this solves some issues. 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
pull_request → pull_request_target
The old event fired in the PR's fork/bot context with a read-only token, requiring maintainer approval. pull_request_target always runs in the base branch context with a write-capable GITHUB_TOKEN no maintainer authorization needed.
Security safeguard added: we check out the PR by its immutable SHA (pr.head.sha), not the branch name. This prevents a malicious PR from being substituted mid-run. The job is also guarded by
github.actor == 'dependabot[bot]'.GitHub App token for re-triggering CI
A commit pushed with GITHUB_TOKEN is explicitly blocked from re-triggering workflows by GitHub (anti-recursion). A GitHub App token bypasses this restriction. The new step conditionally generates one using
actions/create-github-app-tokenwhen APP_ID and APP_PRIVATE_KEY secrets exist. Falls back gracefully to GITHUB_TOKEN (push works, but CI won't auto-rerun).Explicit push target
Checking out by SHA puts git in detached HEAD state. The old git push would fail. Now it uses
git push origin HEAD:"$HEAD_REF"with the branch name surfaced from the PR metadata.workflow_dispatch now accepts pr_number So a maintainer can manually run tidy on any PR without needing to edit the workflow