From 04cfbb9f5a5c2cc27800f3e402b3175219c943d8 Mon Sep 17 00:00:00 2001 From: Arky Asmal Date: Sat, 7 Oct 2023 19:12:36 -0400 Subject: [PATCH 1/2] add github workflow file that prevent pull requests from any branch into main, other than development --- .github/workflows/development_merge_only.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/development_merge_only.yaml diff --git a/.github/workflows/development_merge_only.yaml b/.github/workflows/development_merge_only.yaml new file mode 100644 index 00000000..24c079fa --- /dev/null +++ b/.github/workflows/development_merge_only.yaml @@ -0,0 +1,17 @@ +name: 'Check Branch' +on: + pull_request: + branches: + - main + - master + +jobs: + check_branch: + runs-on: ubuntu-latest + steps: + - name: Check branch + if: github.base_ref == 'main' && github.head_ref != 'development' + uses: actions/github-script@v3 + with: + script: | + core.setFailed('You can only push to main from development branch') \ No newline at end of file From 548625ce9b46904d7a80e759418231e8cbac30ec Mon Sep 17 00:00:00 2001 From: Arky Asmal Date: Sat, 7 Oct 2023 19:14:02 -0400 Subject: [PATCH 2/2] add push request action --- .github/workflows/development_merge_only.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/development_merge_only.yaml b/.github/workflows/development_merge_only.yaml index 24c079fa..0e622eee 100644 --- a/.github/workflows/development_merge_only.yaml +++ b/.github/workflows/development_merge_only.yaml @@ -1,5 +1,9 @@ name: 'Check Branch' on: + push: + branches: + - main + - master pull_request: branches: - main