From c3f8ed47900f21bcb2e0faaeb747040ecd3711ac Mon Sep 17 00:00:00 2001 From: Bayological <6872903+bayological@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:03:49 -0500 Subject: [PATCH] chore: update workflow to prevent non-release PRs to main branch --- .github/workflows/check-branch.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-branch.yml b/.github/workflows/check-branch.yml index d49bf61..92d74c9 100644 --- a/.github/workflows/check-branch.yml +++ b/.github/workflows/check-branch.yml @@ -1,4 +1,4 @@ -name: Prevent PR to Main +name: Prevent Non-Release PRs to Main on: pull_request: @@ -9,7 +9,9 @@ jobs: check-target-branch: runs-on: ubuntu-latest steps: - - name: Fail if PR targets the main branch + - name: Check if the source branch is a release branch run: | - echo "PRs should not be merged into the main branch directly." - exit 1 \ No newline at end of file + if [[ "${{ github.head_ref }}" != release/* ]]; then + echo "Only release branches can be merged into the main branch." + exit 1 + fi \ No newline at end of file