Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
66 changes: 66 additions & 0 deletions .github/workflows/pr-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: PR Auto-merge

on:
pull_request_review:
types: [submitted]

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
name: Auto-merge Release PRs
runs-on: ubuntu-latest
# Only run when PR is approved and it's a release PR
if: |
github.event.review.state == 'approved' &&
github.event.pull_request.user.login == 'github-actions[bot]' &&
startsWith(github.event.pull_request.head.ref, 'release/') &&
github.event.pull_request.base.ref == 'main'

steps:
- name: Check CI status
id: ci-status
uses: actions/github-script@v7
with:
script: |
const { data: checkRuns } = await github.rest.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.payload.pull_request.head.sha
});

// Include ALL required checks
const requiredChecks = [
Copy link
Contributor

Choose a reason for hiding this comment

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

consider adding integration tests too

'Lint',
'Test Python 3.10',
'Test Python 3.11',
'Test Python 3.12',
'Test Python 3.13',
'Build Package'
];

const allPassed = requiredChecks.every(checkName => {
const check = checkRuns.check_runs.find(run => run.name === checkName);
return check && check.conclusion === 'success';
});

console.log(`All required checks passed: ${allPassed}`);
return allPassed;

- name: Auto-merge PR
if: steps.ci-status.outputs.result == 'true'
uses: actions/github-script@v7
with:
script: |
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
merge_method: 'squash',
commit_title: `Release v${context.payload.pull_request.head.ref.split('/')[1]}`,
commit_message: 'Auto-merged by release workflow'
});

console.log('✓ PR auto-merged successfully');
Loading
Loading