Add new functionality to template repo #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: Source branch check | |
on: | |
pull_request: | |
branches: [main] | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- edited | |
jobs: | |
check-main: | |
if: github.base_ref == 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log | |
run: | | |
echo "Base ref: ${{ github.base_ref }}" | |
echo "Head ref: ${{ github.head_ref }}" | |
- name: Check branches | |
run: | | |
if [ ${{ github.head_ref }} != "staging" ]; then | |
echo "Merge requests to main branch are only allowed from staging branch." | |
exit 1 | |
fi |