Skip to content

Commit

Permalink
Merge pull request #10 from PiedTweet/hotfix/update-gh-action
Browse files Browse the repository at this point in the history
Update gh action
  • Loading branch information
nnh53 authored Nov 25, 2023
2 parents d25890d + 2e3fb42 commit 2517fe6
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 2517fe6

Please sign in to comment.