Skip to content

Fix Dependabot auto-merge by using pull_request_target for elevated permissions#331

Merged
greenc-FNAL merged 10 commits intomainfrom
copilot/fix-auto-merge-issues
Feb 17, 2026
Merged

Fix Dependabot auto-merge by using pull_request_target for elevated permissions#331
greenc-FNAL merged 10 commits intomainfrom
copilot/fix-auto-merge-issues

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

  • Investigate the auto-merge failure
  • Identify root cause: GITHUB_TOKEN lacks permission when triggered by Dependabot PRs
  • Research GitHub documentation
  • Determine solution: Use pull_request_target for elevated permissions
  • Implement fix: Change trigger from pull_request to pull_request_target
  • Add better error handling and documentation
  • Document the solution and alternative approaches
  • Address all code review feedback
  • Remove auto-approval step (approval now requires manual human review)
  • Add set -o pipefail for proper error detection
  • Constrain trigger types to avoid running on irrelevant events
  • Explicitly specify bash shell for pipefail compatibility
  • Test the fix on an actual Dependabot PR (waiting for next Dependabot PR)
  • Verify auto-merge works correctly with manual approval

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

dependabot bot and others added 2 commits February 17, 2026 15:46
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.32.2 to 4.32.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@45cbd0c...9e907b5)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Copilot AI and others added 4 commits February 17, 2026 16:03
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues preventing auto-merge from succeeding Fix Dependabot auto-merge by using pull_request_target for elevated permissions Feb 17, 2026
Copilot AI requested a review from greenc-FNAL February 17, 2026 16:09
@greenc-FNAL
Copy link
Contributor

@phlexbot markdown-fix

@greenc-FNAL greenc-FNAL marked this pull request as ready for review February 17, 2026 16:39
Copilot AI review requested due to automatic review settings February 17, 2026 16:39
@greenc-FNAL greenc-FNAL requested review from knoepfel and removed request for greenc-FNAL February 17, 2026 16:47
@greenc-FNAL
Copy link
Contributor

@copilot Project lead is uncomfortable with auto-approve at this time, and would like to preserve approval as a manual step for now, with auto-merge taking place after human approval and all checks have passed. Please remove the auto-approval step.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Dependabot auto-merge automation to reliably enable auto-merge on protected branches by switching the workflow to pull_request_target, adding an auto-approval step, and documenting the security rationale and alternatives.

Changes:

  • Switch workflow trigger from pull_request to pull_request_target for elevated GITHUB_TOKEN permissions on Dependabot PRs.
  • Add an “Approve Dependabot PR” step to satisfy approval-based branch protection requirements.
  • Add dedicated documentation describing behavior, security considerations, and alternatives (GitHub App / PAT).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/dependabot-auto-merge.yaml Moves to pull_request_target, adds auto-approval, and refines error handling for enabling auto-merge.
.github/DEPENDABOT_AUTO_MERGE.md Documents the workflow design, security rationale, and alternative approaches.
Comments suppressed due to low confidence (1)

.github/DEPENDABOT_AUTO_MERGE.md:132

  • The file currently ends with a trailing blank line. Please remove the extra blank line so the file ends with exactly one newline after the last content line.
- [Dependabot fetch-metadata action](https://github.com/dependabot/fetch-metadata)

Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot Project lead is uncomfortable with auto-approve at this time, and would like to preserve approval as a manual step for now, with auto-merge taking place after human approval and all checks ha...

Removed the auto-approval step in commit fcf19a8. The workflow now only enables auto-merge; approval must be done manually. Auto-merge will trigger after human approval and all CI checks pass.

@greenc-FNAL
Copy link
Contributor

@phlexbot format

@github-actions
Copy link
Contributor

No automatic markdownlint fixes were necessary.

@github-actions
Copy link
Contributor

No automatic cmake-format fixes were necessary.

@greenc-FNAL
Copy link
Contributor

@copilot Please address remaining relevant Copilot review comments.

@github-actions
Copy link
Contributor

No automatic jsonnetfmt fixes were necessary.

@github-actions
Copy link
Contributor

No automatic clang-format fixes were necessary.

Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot Please address remaining relevant Copilot review comments.

Addressed both review comments in commit 3dd61c0:

  • Added set -o pipefail to ensure gh pr merge exit code is properly captured
  • Constrained trigger types: pull_request_target: [opened, reopened, synchronize] and pull_request_review: [submitted] to avoid running on irrelevant events

Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Copilot AI requested a review from greenc-FNAL February 17, 2026 17:07
@greenc-FNAL greenc-FNAL changed the base branch from dependabot/github_actions/github/codeql-action-4.32.3 to main February 17, 2026 17:07
@greenc-FNAL greenc-FNAL merged commit b00b2aa into main Feb 17, 2026
49 checks passed
@greenc-FNAL greenc-FNAL deleted the copilot/fix-auto-merge-issues branch February 17, 2026 17:55
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.

4 participants