Skip to content

Commit

Permalink
Update gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
nnh53 committed Nov 25, 2023
1 parent cdccba1 commit 2e3fb42
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/enforcer.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Enforce branch rules
name: Enforce branch workflow

on:
pull_request:
branches:
- main

jobs:
check_branch_main:
job_enforce_main:
runs-on: ubuntu-latest
steps:
- name: Check Branch main
- name: Enforce main
if: github.base_ref == 'main' && !(startsWith(github.head_ref, 'develop') || startsWith(github.head_ref, 'hotfix/'))
run: |
if [[ "${{ github.head_ref }}" != "develop" && ! "${{ github.head_ref }}" =~ ^hotfix/ ]]; then
echo "ERROR: You can only merge to main from develop or hotfix/*."
exit 1
fi
echo "ERROR: You can only merge to main from develop or hotfix/**"
exit 1
21 changes: 21 additions & 0 deletions .github/workflows/hotfix-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Merge "hotfix/**" into "main" and "develop"

on:
pull_request:
branches:
- hotfix/**
types:
- closed

jobs:
merge_hotfix_into_main_and_develop:
runs-on: ubuntu-latest
steps:
- name: Merge hotfix into main and develop
run: |
git checkout main
git merge --no-ff origin/hotfix
git push origin main
git checkout develop
git merge --no-ff origin/hotfix
git push origin develop

0 comments on commit 2e3fb42

Please sign in to comment.