From 3b623404c8d1ad26031c4809b38a1179f16a15b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Imhof?= Date: Sat, 6 Jul 2024 19:49:17 +0200 Subject: [PATCH 1/2] Created safeguard for future PRs Hopefully won't happen again, always learn from your mistakes kids. --- .github/workflows/release-pr-safeguard.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/release-pr-safeguard.yaml diff --git a/.github/workflows/release-pr-safeguard.yaml b/.github/workflows/release-pr-safeguard.yaml new file mode 100644 index 0000000..5690731 --- /dev/null +++ b/.github/workflows/release-pr-safeguard.yaml @@ -0,0 +1,17 @@ +name: Safeguard for release PRs + +on: + pull_request: + branches: + - release + +jobs: + restrict-release: + runs-on: ubuntu-latest + steps: + - name: Check PR Base Branch + run: | + if [[ "${{ github.base_ref }}" != "dev" ]]; then + echo "Pull requests to the release branch must come from the dev branch." + exit 1 + fi From dcbcdfb547f46fb0314832373a393e554ee6de29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Imhof?= Date: Sun, 4 Aug 2024 18:03:42 +0200 Subject: [PATCH 2/2] Fixed mistake in safeguard That's why I should never rely on ChatGPT to learn GitHub workflows... --- .github/workflows/release-pr-safeguard.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-pr-safeguard.yaml b/.github/workflows/release-pr-safeguard.yaml index 5690731..9c3ddf9 100644 --- a/.github/workflows/release-pr-safeguard.yaml +++ b/.github/workflows/release-pr-safeguard.yaml @@ -11,7 +11,7 @@ jobs: steps: - name: Check PR Base Branch run: | - if [[ "${{ github.base_ref }}" != "dev" ]]; then + if [[ "${{ github.head_ref }}" != "dev" ]]; then echo "Pull requests to the release branch must come from the dev branch." exit 1 fi