Skip to content

Release Auto-merge

Release Auto-merge #1

name: Release Auto-merge
on:
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
auto-merge:
name: Auto-merge release pull requests
runs-on: ubuntu-latest
steps:
- name: Find release pull request, approve and enable auto-merge
env:
GH_TOKEN: ${{ secrets.LOCALSTACK_BOT_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
gh pr list \
--label "autorelease: pending" \
--state open \
--json number \
--jq '.[].number' | \
while read -r pr; do
echo "Approving and enabling auto-merge on PR #$pr"
gh pr review "$pr" --approve --comment --body "Auto-approve weekly releases"
gh pr merge "$pr" --auto --squash
done