release branch: change workflow #1
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: Block Pull Requests with 'Merge branch develop' Commits | |
on: | |
push: | |
branches: | |
- develop | |
- release/* | |
pull_request_target: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- 'release/*' | |
jobs: | |
block_merge: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check for 'Merge branch develop' Commits | |
if: | | |
( | |
github.event.pull_request.head.ref == 'release/*' && | |
github.event.pull_request.base.ref == 'develop' | |
) | |
run: | | |
if git log --merges --ancestry-path HEAD^..HEAD --pretty=format:%s | grep -q "Merge branch 'develop'"; then | |
echo "ERROR: This Pull Request contains a merge commit from 'develop'. Merging from 'develop' is not allowed." | |
exit 1 | |
fi |