Merge pull request #8 from artisan-community/start-automating-package… #7
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: Prevent Direct Push to Main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
prevent-direct-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if Push is Direct | |
run: | | |
if [[ "${{ github.event_name }}" == "push" && "${{ github.event.head_commit.message }}" != *"Merge pull request"* ]]; then | |
echo "Direct pushes to the main branch are not allowed. Please use a pull request." | |
exit 1 | |
fi |