diff --git a/.github/workflows/sync-openapi.yml b/.github/workflows/sync-openapi.yml index 3f61207c..c54d6ee4 100644 --- a/.github/workflows/sync-openapi.yml +++ b/.github/workflows/sync-openapi.yml @@ -44,10 +44,17 @@ jobs: branch: "chore/sync-openapi" delete-branch: true - - name: Enable auto-merge (when checks pass) + - name: Wait for checks and merge if: steps.cpr.outputs.pull-request-number != '' - uses: peter-evans/enable-pull-request-automerge@v3 - with: - token: ${{ secrets.DOCS_BOT_TOKEN }} - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} - merge-method: squash + env: + GH_TOKEN: ${{ secrets.DOCS_BOT_TOKEN }} + run: | + set -euo pipefail + pr="${{ steps.cpr.outputs.pull-request-number }}" + # Give the pull_request workflow a moment to register checks before watching. + for i in $(seq 1 10); do + if gh pr checks "$pr" -R "$GITHUB_REPOSITORY" >/dev/null 2>&1; then break; fi + sleep 15 + done + gh pr checks "$pr" -R "$GITHUB_REPOSITORY" --watch --fail-fast --interval 30 + gh pr merge "$pr" -R "$GITHUB_REPOSITORY" --squash --delete-branch