Pull Requests auto-merge #744
This file contains 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: Pull Requests auto-merge | |
on: | |
workflow_run: | |
workflows: ["Test and Measure"] | |
types: | |
- completed | |
permissions: | |
pull-requests: write | |
contents: write | |
# Cancel previous workflow run groups that have not completed. | |
concurrency: | |
# Group workflow runs by workflow name and branch name of pull request. | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
dependabot: | |
name: Dependabot PR auto-merge | |
runs-on: ubuntu-latest | |
if: ${{ github.actor == 'dependabot[bot]' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Approve and merge the PR | |
if: | | |
contains( github.event.workflow_run.head_commit.message, 'version-update:semver-minor' ) || | |
contains( github.event.workflow_run.head_commit.message, 'version-update:semver-patch' ) | |
run: gh pr merge "$PR_NUMBER" --auto --merge --delete-branch | |
env: | |
PR_NUMBER: ${{github.event.workflow_run.pull_requests[0].number}} | |
GITHUB_TOKEN: ${{secrets.GH_BOT_TOKEN}} | |
gutenberg-packages: | |
name: Gutenberg packages update PR auto-merge | |
runs-on: ubuntu-latest | |
if: ${{ github.actor == 'rtBot' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Approve and merge the PR | |
if: | | |
startsWith(github.event.workflow_run.head_commit.message, 'Update WordPress NPM packages based on Gutenberg release') && | |
endsWith(github.event.workflow_run.head_commit.message, format('{0} {1}', 'rtBot', '<[email protected]>')) && | |
github.event.workflow_run.head_commit.author.name == 'rtBot' && | |
github.event.workflow_run.head_commit.author.email == '[email protected]' | |
run: gh pr merge "$PR_NUMBER" --auto --merge --delete-branch | |
env: | |
PR_NUMBER: ${{github.event.workflow_run.pull_requests[0].number}} | |
GITHUB_TOKEN: ${{secrets.GH_BOT_TOKEN}} |