From 15a2ed4c9e2ff97e092f6be40837bdbc3c48b9da Mon Sep 17 00:00:00 2001 From: seungyeop-lee Date: Wed, 24 Jul 2024 01:18:58 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20PR=20=EB=A8=B8=EC=A7=80=20=EB=A3=B0=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=20=EC=B6=94=EA=B0=80=20#180?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/branch-protection-rules.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/branch-protection-rules.yml diff --git a/.github/workflows/branch-protection-rules.yml b/.github/workflows/branch-protection-rules.yml new file mode 100644 index 0000000..25086be --- /dev/null +++ b/.github/workflows/branch-protection-rules.yml @@ -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