Created
November 19, 2024 15:47
-
-
Save paprikka/41435ef90c314b295a3009609fbb5337 to your computer and use it in GitHub Desktop.
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: Prevent Merge if [no ci] is in Commits | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
check-commits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Validate Commit Messages | |
run: | | |
# Fetch all commits in the pull request | |
git fetch origin ${{ github.event.pull_request.base.ref }} \ | |
${{ github.event.pull_request.head.ref }} | |
# Check for [no ci] in commit messages | |
if git log --pretty=format:%s origin/${{ github.event.pull_request.base.ref }}..HEAD | grep -iq "\[no ci\]"; then | |
echo "Error: '[no ci]' found in commit messages."; | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment