No Merge Commits Action
ActionsA Github Action to detect merge commits in pull requests and to prevent them from being merged.
This action will query GitHub REST API to find all commits in a pull request. After that, this will analyse the response data and check if there are merge commits. If there are any, this action will error and exit.
name: Detect Merge Commits
on:
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
test:
name: Check for merge commits
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run test
uses: NexusPHP/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
You'll also need to add a required status check rule for your action to block merging if it detects merge commits.
No Merge Commits Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.