Skip to content

Auto-merge Speakeasy PRs #25

Auto-merge Speakeasy PRs

Auto-merge Speakeasy PRs #25

name: Auto-merge Speakeasy PRs
on:
workflow_run:
workflows: ["Test"]
types: [completed]
jobs:
auto-merge:
if: >
github.event.workflow_run.conclusion == 'success' &&
startsWith(github.event.workflow_run.head_branch, 'speakeasy-sdk-regen-')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Enable auto-merge
run: |
PR_NUMBER=$(gh pr list --head "${{ github.event.workflow_run.head_branch }}" --json number -q '.[0].number' --repo "${{ github.repository }}")
if [ -n "$PR_NUMBER" ]; then
gh pr merge "$PR_NUMBER" --auto --squash --repo "${{ github.repository }}"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}