Add workflow to auto-approve workflow runs on main branch#2962
Merged
Add workflow to auto-approve workflow runs on main branch#2962
Conversation
Co-authored-by: plengauer <100447901+plengauer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add workflow to auto-approve runs on main branch
Add workflow to auto-approve workflow runs on main branch
Feb 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to automatically approve workflow_run executions on main that end up in action_required, avoiding manual approvals.
Changes:
- Introduces a new
.github/workflows/autoapprove_workflow_runs.ymlworkflow. - Triggers on
workflow_run(completed) and conditionally runs an approval job. - Uses
gh apiwithactions: writeto approve the run by ID.
plengauer
approved these changes
Feb 20, 2026
moflwi
approved these changes
Feb 21, 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.
Workflow runs triggered on
mainthat land inaction_requiredstate (e.g. first-time contributor forks) are never automatically approved, requiring manual intervention.Changes
.github/workflows/autoapprove_workflow_runs.yml:workflow_runcompleted events across all workflows ('*')approvejob gated by a YAML-levelif— no logic inside the script:gh api POST .../actions/runs/$RUN_ID/approveactions: write; run ID passed via env var to avoid injectionOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.