Skip to content

Feature: v3.0.0

Feature: v3.0.0 #48

# The adRise/update-pr-branch action has force-pushed an empty branch to outside contributions
# before (e.g. https://github.com/emmercm/igir/pull/943), causing the PR to merge but no code to
# actually end up in the main repository. This action is to automatically disable auto-merge in
# case this ever gets enabled again.
name: GitHub Auto-Merge Disabler
on:
pull_request_target:
types:
- edited
jobs:
disable-auto-merge:
if: ${{ github.event.pull_request.auto_merge && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
permissions:
# actions/checkout@v4, `gh` CLI
contents: write
# `gh` CLI
repository-projects: read
pull-requests: write
runs-on: ubuntu-latest
steps:
# Required for `gh` CLI
- uses: actions/checkout@v4
- run: gh pr merge "${{ github.event.pull_request.number }}" --disable-auto
env:
GH_TOKEN: ${{ github.token }}
- uses: thollander/actions-comment-pull-request@v2
with:
message: |
## :warning: Disabling auto-merge
Auto-merge is problematic for outside contributions. A maintainer will need to merge this pull request manually.
_Comment generated by the [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) workflow._
mode: recreate
comment_tag: gh-automerge-disabler
remove-comment:
if: ${{ !github.event.pull_request.auto_merge || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: thollander/actions-comment-pull-request@v2
with:
message: Deleting
mode: delete
comment_tag: gh-automerge-disabler