Skip to content

Commit 47bd6c6

Browse files
authored
Fix bump workflow by explicitly using if construct (#432)
2 parents 48291ad + 2170d51 commit 47bd6c6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/version_bump.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
LATEST_TAG=$(gh -R $REPO release list -L 1 | awk '{printf $3}')
1818
echo "Latest version tag for releases in $REPO is $LATEST_TAG"
1919
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
20-
[[ -z ${LATEST_TAG} ]] && echo "Error: LATEST_TAG is empty, aborting" && exit 1
20+
# Exit when LATEST_TAG is empty, due to github connection errors
21+
if [[ -z "${LATEST_TAG}" ]]; then echo "Error: LATEST_TAG is empty, aborting" && exit 1; fi;
22+
shell: bash
2123

2224
- name: Checkout code
2325
uses: actions/[email protected]
@@ -28,14 +30,16 @@ jobs:
2830
run: |
2931
LATEST_TAG=${{ env.latest_tag }}
3032
REMOTE_BRANCH=$(git ls-remote --heads origin "bump_$LATEST_TAG")
31-
[[ -z ${REMOTE_BRANCH} ]] && echo "branch_exists=false" >> $GITHUB_ENV || echo "branch_exists=true" >> $GITHUB_ENV
32-
[[ -z ${REMOTE_BRANCH} ]] && echo "Remote branch bump_$LATEST_TAG does not exist" || echo "Remote branch bump_$LATEST_TAG already exists"
33+
[[ -z "${REMOTE_BRANCH}" ]] && echo "branch_exists=false" >> $GITHUB_ENV || echo "branch_exists=true" >> $GITHUB_ENV
34+
[[ -z "${REMOTE_BRANCH}" ]] && echo "Remote branch bump_$LATEST_TAG does not exist" || echo "Remote branch bump_$LATEST_TAG already exists"
35+
shell: bash
3336

3437
- name: Get current version
3538
run: |
3639
CURRENT_VERSION=$(cat padd.sh | grep '^padd_version=' | cut -d'"' -f 2)
3740
echo "Current PADD version is $CURRENT_VERSION"
3841
echo "current_version=$CURRENT_VERSION" >> $GITHUB_ENV
42+
shell: bash
3943

4044
- name: Create PR if versions don't match and branch does not exist
4145
if: (env.current_version != env.latest_tag) && (env.branch_exists == 'false')
@@ -48,3 +52,4 @@ jobs:
4852
git commit -a -m "Bump version to $LATEST_TAG"
4953
git push --set-upstream origin "bump_$LATEST_TAG"
5054
gh pr create -B development -H "bump_$LATEST_TAG" --title "Bump version to ${LATEST_TAG}" --body 'Created by Github action' --label 'Internal'
55+
shell: bash

0 commit comments

Comments
 (0)