From 3bfdc8958d93a0e0e768e1758316470a0e4bc8ac Mon Sep 17 00:00:00 2001 From: Jakub Panek Date: Thu, 15 Aug 2024 06:21:37 +0200 Subject: [PATCH] ci: add staging/main check --- .forgejo/workflows/merge-main-check.yml | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .forgejo/workflows/merge-main-check.yml diff --git a/.forgejo/workflows/merge-main-check.yml b/.forgejo/workflows/merge-main-check.yml new file mode 100644 index 0000000..c95b1c0 --- /dev/null +++ b/.forgejo/workflows/merge-main-check.yml @@ -0,0 +1,26 @@ +name: merge-main-check +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + +defaults: + run: + shell: 'sh -e {0}' + +jobs: + check: + runs-on: shell + if: github.base_ref == 'main' + steps: + - name: Check if non-staging -> main + if: github.head_ref != 'staging' + run: echo 'Cannot merge non-staging branch to main'; exit 1 + + - name: Check if staging -> main + if: github.head_ref == 'staging' + run: echo 'Merge from staging branch to main allowed'; exit 0 +