From 8e969e398d2a05ab0085ae6ffd59cb811e88e925 Mon Sep 17 00:00:00 2001 From: Fern Support <126544928+fern-support@users.noreply.github.com> Date: Mon, 27 Oct 2025 17:41:11 -0400 Subject: [PATCH] Enhance auto-merge logic for OpenAPI update PRs Added logic to wait for PR creation and find the most recent PR for auto-merge. --- .github/workflows/update-openapi.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-openapi.yml b/.github/workflows/update-openapi.yml index fd56dd9c1..acae77cb1 100644 --- a/.github/workflows/update-openapi.yml +++ b/.github/workflows/update-openapi.yml @@ -24,8 +24,16 @@ jobs: update_from_source: true add_timestamp: true - name: Enable auto-merge - if: steps.sync-openapi.outputs.pr_number != '' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh pr merge ${{ steps.sync-openapi.outputs.pr_number }} --auto --squash + # Wait a moment for PR to be fully created + sleep 5 + # Get the most recent PR that starts with update-openapi-spec + PR_NUMBER=$(gh pr list --head update-openapi-spec --json number,headRefName --jq 'map(select(.headRefName | startswith("update-openapi-spec"))) | .[0].number') + if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then + echo "Found PR #$PR_NUMBER, enabling auto-merge" + gh pr merge $PR_NUMBER --auto --squash + else + echo "No PR found for branch starting with update-openapi-spec" + fi