Auto-merge · Bot PRs #4406
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto-merge · Bot PRs | |
| on: | |
| pull_request: | |
| branches: [master] | |
| types: [opened, synchronize, reopened] | |
| workflow_run: | |
| workflows: ['CI · Validate site'] | |
| types: [completed] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| checks: read | |
| jobs: | |
| auto-merge: | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout scripts | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| .github/scripts | |
| sparse-checkout-cone-mode: false | |
| - name: Dependabot semver gate | |
| id: dependabot_gate | |
| if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'app/dependabot') | |
| uses: dependabot/fetch-metadata@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| skip-commit-verification: true | |
| - name: Merge bot PR (as fineanmol) | |
| id: merge_fineanmol | |
| if: | | |
| github.event_name == 'workflow_run' || | |
| (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.user.login != 'app/dependabot') || | |
| steps.dependabot_gate.outputs.update-type != 'version-update:semver-major' || | |
| steps.dependabot_gate.outputs.package-ecosystem == 'github_actions' | |
| continue-on-error: true | |
| uses: actions/github-script@v7 | |
| env: | |
| REQUIRED_CHECK_NAME: validate | |
| with: | |
| github-token: ${{ secrets.AUTOMERGE_TOKEN }} | |
| script: | | |
| const run = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/auto-merge-bot-pr.js`); | |
| await run({ github, context, core }); | |
| - name: Merge bot PR (fallback) | |
| if: steps.merge_fineanmol.outcome == 'failure' | |
| uses: actions/github-script@v7 | |
| env: | |
| REQUIRED_CHECK_NAME: validate | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const run = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/auto-merge-bot-pr.js`); | |
| await run({ github, context, core }); |