From 2d6a4143d796b2d3ee43ca79d7e96267b2f5e7ed Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Fri, 3 Jun 2022 10:10:09 -0700 Subject: [PATCH] Warn and block staging release if not run in a release branch (#6325) --- .github/workflows/release-staging.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release-staging.yml b/.github/workflows/release-staging.yml index 61a32b56be1..a45e0f57ef7 100644 --- a/.github/workflows/release-staging.yml +++ b/.github/workflows/release-staging.yml @@ -3,9 +3,19 @@ name: Staging Release on: workflow_dispatch jobs: + warn: + name: Warn If Wrong Branch + runs-on: ubuntu-latest + # Log a warning if run in a non-release branch. + if: github.ref != 'refs/heads/release' && !endsWith(github.ref, '-releasebranch') + steps: + - name: Log warning + run: echo "This workflow must be run in a release branch. It is being run in ${{ github.ref }}." deploy: name: Staging Release runs-on: ubuntu-latest + # Block this workflow if run in a non-release branch. + if: github.ref == 'refs/heads/release' || endsWith(github.ref, '-releasebranch') # Allow GITHUB_TOKEN to have write permissions permissions: contents: write