Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/approve-by-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Approve by automation

on:
pull_request:
types: [opened, reopened, synchronize]

permissions:
pull-requests: write

jobs:
approve-release-pr:
if: startsWith(github.head_ref, 'release/v')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict auto-approval to real release branches

In a same-repository PR whose source branch merely starts with release/v, this job submits an approving review without checking the base branch, actor, or the semver release-branch pattern used by .github/workflows/release-workflow.yml (^release/v[0-9]+\.[0-9]+\.[0-9]+$). That lets any write-access user create something like release/v-anything targeting main and have the one required GitHub approval satisfied by automation, bypassing the human review gate for non-release changes that pass required checks. Please tighten this condition to the exact release branch format and intended target/actor before approving.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

runs-on: ubuntu-latest
steps:
- name: Approve release pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr review "${{ github.event.pull_request.number }}" \
--approve \
--body "Auto-approved: release branch PR. Release is gated by the Jira EM approval." \
--repo "${{ github.repository }}"