Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.06 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.06 KB

git-merge No Merge Commits Action

A Github Action to detect merge commits in pull requests and to prevent them from being merged.

How this works

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.

Usage

name: Detect Merge Commits

on:
  pull_request:

permissions:
  contents: read
  pull-requests: read

jobs:
  test:
    name: Check for merge commits
    runs-on: ubuntu-22.04

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Run test
        uses: NexusPHP/no-merge-commits@v2.1.0
        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.