From 04716e4e1e7bff259da6d81628b80021c4ada0cb Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Fri, 19 Jul 2024 14:40:05 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20pr=20base=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.github/workflows/change-pr-target.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 frontend/.github/workflows/change-pr-target.yaml diff --git a/frontend/.github/workflows/change-pr-target.yaml b/frontend/.github/workflows/change-pr-target.yaml new file mode 100644 index 0000000..b7e76f6 --- /dev/null +++ b/frontend/.github/workflows/change-pr-target.yaml @@ -0,0 +1,28 @@ +name: Change PR target if base branch is master + +on: + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - master + +jobs: + change-pr-target: + runs-on: ubuntu-latest + steps: + - name: Set target environment variable + run: | + if [[ "${GITHUB_HEAD_REF}" == fe* || "${GITHUB_HEAD_REF}" == FE* ]]; then + echo "target=frontend" >> $GITHUB_ENV + elif [[ "${GITHUB_HEAD_REF}" == be* || "${GITHUB_HEAD_REF}" == BE* ]]; then + echo "target=backend" >> $GITHUB_ENV + fi + + - name: Change base branch for PR + if: env.target == 'frontend' || env.target == 'backend' + run: gh pr edit ${{ github.event.pull_request.number }} --base ${{ env.target }} --repo ${{ github.repository }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}