Skip to content

Commit

Permalink
chore: PR 머지 룰 확인 추가 #180
Browse files Browse the repository at this point in the history
  • Loading branch information
seungyeop-lee committed Jul 23, 2024
1 parent 25946a5 commit 15a2ed4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/branch-protection-rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Branch Protection Rules

on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
check-branch-rules:
runs-on: ubuntu-latest
steps:
- name: "develop 브랜치 머지 룰 확인"
if: github.event.pull_request.base.ref == 'develop'
run: |
HEAD_BRANCH="${{ github.event.pull_request.head.ref }}"
if [[ "$HEAD_BRANCH" != issue/* && "$HEAD_BRANCH" != bugfix/* && "$HEAD_BRANCH" != hotfix/* ]]; then
echo "'issue/', 'bugfix/' 또는 'hotfix/'로 시작하는 브랜치만 'develop' 브랜치로 머지할 수 있습니다."
exit 1
fi
- name: "release 브랜치 머지 룰 확인"
if: github.event.pull_request.base.ref == 'release'
run: |
HEAD_BRANCH="${{ github.event.pull_request.head.ref }}"
if [[ "$HEAD_BRANCH" != 'develop' && "$HEAD_BRANCH" != bugfix/* ]]; then
echo "'develop' 또는 'bugfix/'로 시작하는 브랜치만 'release' 브랜치로 머지할 수 있습니다."
exit 1
fi
- name: "main 브랜치 머지 룰 확인"
if: github.event.pull_request.base.ref == 'main'
run: |
HEAD_BRANCH="${{ github.event.pull_request.head.ref }}"
if [[ "$HEAD_BRANCH" != 'release' && "$HEAD_BRANCH" != hotfix/* ]]; then
echo "'release' 또는 'hotfix/'로 시작하는 브랜치만 'main' 브랜치로 머지할 수 있습니다."
exit 1
fi

0 comments on commit 15a2ed4

Please sign in to comment.