diff --git a/.github/workflows/sync-agent-sdk-openapi.yml b/.github/workflows/sync-agent-sdk-openapi.yml index 15b2c217..169574c5 100644 --- a/.github/workflows/sync-agent-sdk-openapi.yml +++ b/.github/workflows/sync-agent-sdk-openapi.yml @@ -14,6 +14,10 @@ permissions: contents: write pull-requests: write +concurrency: + group: sync-agent-sdk-openapi + cancel-in-progress: true + jobs: sync-openapi: runs-on: ubuntu-latest @@ -81,6 +85,7 @@ jobs: - name: Create Pull Request if: steps.detect_changes.outputs.changes == 'true' + id: cpr uses: peter-evans/create-pull-request@v7 with: add-paths: openapi/agent-sdk.json @@ -105,3 +110,24 @@ jobs: - [x] If the change is significant, I have run the documentation site locally and confirmed it renders as expected. **Note**: This is an automated pull request. Please review the changes to ensure they are correct before merging. + + - name: Auto-approve PR + if: steps.cpr.outputs.pull-request-url && secrets.DOCS_SYNC_TOKEN + env: + GH_TOKEN: ${{ secrets.DOCS_SYNC_TOKEN }} + run: | + gh pr review "${{ steps.cpr.outputs.pull-request-url }}" \ + --approve \ + --body "Auto-approving automated OpenAPI sync PR." + + - name: Enable auto-merge (squash) + if: steps.cpr.outputs.pull-request-url && secrets.DOCS_SYNC_TOKEN + env: + GH_TOKEN: ${{ secrets.DOCS_SYNC_TOKEN }} + run: | + PR_URL="${{ steps.cpr.outputs.pull-request-url }}" + + # Prefer auto-merge (merges when required checks finish). + # If auto-merge isn't enabled for the repo, fall back to attempting an immediate merge. + gh pr merge "$PR_URL" --auto --delete-branch --squash \ + || gh pr merge "$PR_URL" --delete-branch --squash diff --git a/.github/workflows/sync-docs-code-blocks.yml b/.github/workflows/sync-docs-code-blocks.yml index 4466f631..3dd32283 100644 --- a/.github/workflows/sync-docs-code-blocks.yml +++ b/.github/workflows/sync-docs-code-blocks.yml @@ -15,6 +15,10 @@ permissions: contents: write pull-requests: write +concurrency: + group: sync-docs-code-blocks + cancel-in-progress: true + jobs: sync-code-blocks: runs-on: ubuntu-latest @@ -69,6 +73,7 @@ jobs: - name: Create Pull Request if: steps.detect_changes.outputs.changes == 'true' + id: cpr uses: peter-evans/create-pull-request@v7 with: commit-message: | @@ -94,3 +99,24 @@ jobs: ### Checklist - [x] I have read and reviewed the documentation changes to the best of my ability. - [x] If the change is significant, I have run the documentation site locally and confirmed it renders as expected. + + - name: Auto-approve PR + if: steps.cpr.outputs.pull-request-url && secrets.DOCS_SYNC_TOKEN + env: + GH_TOKEN: ${{ secrets.DOCS_SYNC_TOKEN }} + run: | + gh pr review "${{ steps.cpr.outputs.pull-request-url }}" \ + --approve \ + --body "Auto-approving automated docs sync PR." + + - name: Enable auto-merge (squash) + if: steps.cpr.outputs.pull-request-url && secrets.DOCS_SYNC_TOKEN + env: + GH_TOKEN: ${{ secrets.DOCS_SYNC_TOKEN }} + run: | + PR_URL="${{ steps.cpr.outputs.pull-request-url }}" + + # Prefer auto-merge (merges when required checks finish). + # If auto-merge isn't enabled for the repo, fall back to attempting an immediate merge. + gh pr merge "$PR_URL" --auto --delete-branch --squash \ + || gh pr merge "$PR_URL" --delete-branch --squash