Skip to content

Commit

Permalink
Fixing branch detection. Adding error handling if branch provided is …
Browse files Browse the repository at this point in the history
…neither develop or master (#1329)
  • Loading branch information
kevinpalis authored Jul 11, 2024
1 parent e52f2c1 commit b8a753e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/warp_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# This action releases from develop/master for all changed pipelines
name: WARP Release

Expand Down Expand Up @@ -40,16 +39,20 @@ jobs:
run: |
source scripts/common.sh
set -e
if [[ "${GIT_BRANCH}" == "develop" ]]; then
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
if [[ "${BRANCH_NAME}" == "develop" ]]; then
ENV=dev
elif [[ "${GIT_BRANCH}" == "master" ]]; then
elif [[ "${BRANCH_NAME}" == "master" ]]; then
ENV=prod
else
echo "Error: Branch ${BRANCH_NAME} is not a valid release branch."
exit 1
fi
echo $ENV
echo "Getting all changed pipelines since last commit before releasing from develop"
previous_commit_hash=$(git rev-parse HEAD^1)
changed_pipelines=$(get_modified_pipelines ${previous_commit_hash})
echo branch: ${GIT_BRANCH} previous_commit_hash: ${previous_commit_hash} env: ${ENV}
echo branch: ${BRANCH_NAME} previous_commit_hash: ${previous_commit_hash} env: ${ENV}
if [[ -n ${ENV} ]]; then
if [[ -n ${changed_pipelines[@]} ]]; then
for pipeline in ${changed_pipelines[@]}; do
Expand All @@ -62,6 +65,4 @@ jobs:
echo "Releases are only made on merge to develop and master"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit b8a753e

Please sign in to comment.