Skip to content

Commit 69b612d

Browse files
committed
fix(ci): use pull_request_target so dependabot auto-merge can read secrets
A dependabot[bot]-triggered pull_request event gets no secret access at all, a hard GitHub Actions restriction, not a config problem. This job never checks out or runs the PR's own code, so pull_request_target is safe here.
1 parent 9286b56 commit 69b612d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/dependabot-auto-merge.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ name: Dependabot auto-merge
33
# Two auto-merge policies in one workflow. Sibling ExaDev packages (documents.js/odf.js) merge unconditionally once green -- no cooldown, matching this family's existing convention. Every other (third-party) dependency merges only for a minor or patch bump; a major bump still opens a PR via Dependabot but is left for manual review. Third-party updates additionally carry dependabot.yml's own 7-day cooldown before Dependabot proposes them at all. Auto-merge is enforced by main's own CI actually passing on the PR's head commit -- this workflow only requests the merge, GitHub itself withholds it until checks conclude -- and the merge authenticates via a GitHub App installation token specifically so the resulting push cascades into ci.yml/release, unlike a GITHUB_TOKEN-authenticated push.
44

55
on:
6-
pull_request:
6+
# pull_request_target, not pull_request -- a workflow run triggered by dependabot[bot]'s own pull_request
7+
# event gets NO secret access at all (a hard GitHub Actions security restriction against a compromised
8+
# dependency update exfiltrating secrets), so secrets.AUTOMERGE_APP_PRIVATE_KEY would resolve empty
9+
# regardless of how correctly the secret itself is configured. pull_request_target runs using the base
10+
# branch's own workflow file and normal secret access instead. Safe here specifically because this job
11+
# never checks out or executes the PR's own code -- it only calls the GitHub API (fetch-metadata, gh pr
12+
# merge), which is exactly the case pull_request_target's own security guidance calls out as safe.
13+
pull_request_target:
714

815
permissions:
916
contents: write

0 commit comments

Comments
 (0)