Fix Dependabot Milestone workflow by granting pull-requests: write#7110
Merged
amartinezfayo merged 1 commit intoJul 2, 2026
Merged
Conversation
Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
amartinezfayo
requested review from
MarcosDY,
rturner3 and
sorindumitru
as code owners
July 1, 2026 17:38
There was a problem hiding this comment.
Pull request overview
Fixes the Dependabot Milestone GitHub Actions workflow so it can successfully assign a milestone to Dependabot pull requests by adjusting the workflow token permissions.
Changes:
- Updates the workflow
permissionsto grantpull-requests: write(with explanatory comments) so the milestone assignment PATCH can succeed for PR targets. - Adjusts the job comment to reflect the
pull_request_targetexecution context and token capabilities.
sorindumitru
approved these changes
Jul 2, 2026
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.
The Dependabot Milestone workflow has failed on every Dependabot pull request since it was introduced. The job runs to completion, resolves the target milestone, and then fails on the final step that sets the milestone with
gh: Resource not accessible by integration (HTTP 403).The root cause is the workflow
permissionsblock. It grantedcontents: readandissues: write, but declaring an explicit block sets every unlisted scope tonone, includingpull-requests. Setting a milestone on a Dependabot PR goes through thePATCH /repos/{repo}/issues/{n}REST endpoint, but because the target object is a pull request, GitHub checks the write against the pull-requests scope rather than issues, soissues: writealone is rejected.This regressed in #7070, which dropped the old
dependabot_automerge.ymlworkflow and moved the milestone logic into the standalonedependabot_milestone.yml. The milestone call is unchanged, but the old workflow grantedpull-requests: write(alongsidecontents: writeandissues: write), and the new workflow carried overissues: writewhile dropping thepull-requests: writescope that the call actually needs.This is not the Dependabot read-only token restriction. The workflow uses
pull_request_targetwith a base ref onmain, so the run gets a write-capable token and secrets are available, which is why the read API calls earlier in the job succeed.This PR replaces
issues: writewithpull-requests: write. The workflow only ever writes to a Dependabot pull request, soissues: writewas never exercised and is dropped.An example of a failure is here: https://github.com/spiffe/spire/actions/runs/28531397631