Skip to content
Merged
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
25 changes: 16 additions & 9 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Auto Merge
on:
pull_request_target:
types:
- labeled
- synchronize
schedule:
- cron: '*/30 * * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
contents: read
jobs:
automerge:
if: contains(github.event.pull_request.labels.*.name, 'automerge')
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
Expand All @@ -20,8 +17,18 @@ jobs:
private-key: ${{ secrets.AUTOMERGE_APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Enable auto-merge
- name: Batch enable auto-merge
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPO: ${{ github.repository }}
run: |
gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
prs=$(gh pr list --label automerge --state open --json number --jq '.[].number')
if [ -z "$prs" ]; then
echo "No PRs with automerge label."
exit 0
fi
echo "Found PRs: $prs"
for num in $prs; do
echo "Enabling auto-merge for PR #$num..."
gh pr merge "$num" --auto --squash
done
Loading