Hotfix one (#83) #8
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
# This workflow merges a hotfix_ branch into dev | |
# when the branch is a hotfix_. A hotfix_ branch branches | |
# from main so we may forget to merge it back into dev | |
name: merge-hot-fix-branch | |
on: | |
push: | |
branches: | |
- 'master' | |
# for this PR set the variable contains_hot_fix to zero and then update it | |
# only if the branch starts with hotfix_ | |
jobs: | |
check_branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract branch name | |
id: search_hot_fix | |
shell: bash | |
run: | | |
echo "contains_hot_fix=0" >> $GITHUB_OUTPUT | |
if [[ $GITHUB_HEAD_REF == *"hotfix_"* ]]; then | |
echo "contains_hot_fix=1" >> $GITHUB_OUTPUT | |
fi | |
- name: Message System Hot Fix | |
if: steps.search_hot_fix.outputs.contains_hot_fix == 1 | |
run: echo "Branch name contains hot_fix_." | |
- name: Message System Not Hot Fix | |
if: steps.search_hot_fix.outputs.contains_hot_fix == 0 | |
run: echo "Branch name does not contain hot_fix_." | |
- name: Check branch | |
if: github.base_ref == 'master' && github.head_ref != 'develop' && steps.search_hot_fix.outputs.contains_hot_fix == 0 | |
run: | | |
echo "ERROR: You can only merge to main branch from develop branch or a hotfix_ branch." | |
exit 1 | |
- name: Merge master -> develop | |
with: | |
type: now | |
from_branch: master | |
target_branch: develop | |
message: Merge master branch | |
github_token: ${{secrets.GITHUB_TOKEN}} | |