Skip to content

Commit bce749b

Browse files
committed
Improve consistency of variable references in Bash
1 parent fce4a01 commit bce749b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.github/workflows/post-release-mergeback.yml

+22-22
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Dump GitHub context
3434
env:
3535
GITHUB_CONTEXT: '${{ toJson(github) }}'
36-
run: echo "$GITHUB_CONTEXT"
36+
run: echo "${GITHUB_CONTEXT}"
3737

3838
- uses: actions/checkout@v3
3939
- uses: actions/setup-node@v3
@@ -47,39 +47,39 @@ jobs:
4747
id: getVersion
4848
run: |
4949
VERSION="v$(jq '.version' -r 'package.json')"
50-
SHORT_SHA="${GITHUB_SHA:0:8}"
51-
echo "::set-output name=version::$VERSION"
52-
NEW_BRANCH="mergeback/${VERSION}-to-${BASE_BRANCH}-${SHORT_SHA}"
53-
echo "::set-output name=newBranch::$NEW_BRANCH"
50+
echo "::set-output name=version::${VERSION}"
51+
short_sha="${GITHUB_SHA:0:8}"
52+
NEW_BRANCH="mergeback/${VERSION}-to-${BASE_BRANCH}-${short_sha}"
53+
echo "::set-output name=newBranch::${NEW_BRANCH}"
5454
5555
5656
- name: Dump branches
5757
env:
5858
NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"
5959
run: |
60-
echo "BASE_BRANCH $BASE_BRANCH"
61-
echo "HEAD_BRANCH $HEAD_BRANCH"
62-
echo "NEW_BRANCH $NEW_BRANCH"
60+
echo "BASE_BRANCH ${BASE_BRANCH}"
61+
echo "HEAD_BRANCH ${HEAD_BRANCH}"
62+
echo "NEW_BRANCH ${NEW_BRANCH}"
6363
6464
- name: Create mergeback branch
6565
env:
6666
NEW_BRANCH: "${{ steps.getVersion.outputs.newBranch }}"
6767
run: |
68-
git checkout -b "$NEW_BRANCH"
68+
git checkout -b "${NEW_BRANCH}"
6969
7070
- name: Check for tag
7171
id: check
7272
env:
7373
VERSION: "${{ steps.getVersion.outputs.version }}"
7474
run: |
7575
set +e # don't fail on an errored command
76-
git ls-remote --tags origin | grep "$VERSION"
77-
EXISTS="$?"
78-
if [ "$EXISTS" -eq 0 ]; then
79-
echo "Tag $TAG exists. Not going to re-release."
76+
git ls-remote --tags origin | grep "${VERSION}"
77+
exists="$?"
78+
if [ "${exists}" -eq 0 ]; then
79+
echo "Tag ${VERSION} exists. Not going to re-release."
8080
echo "::set-output name=exists::true"
8181
else
82-
echo "Tag $TAG does not exist yet."
82+
echo "Tag ${VERSION} does not exist yet."
8383
fi
8484
8585
# we didn't tag the release during the update-release-branch workflow because the
@@ -113,25 +113,25 @@ jobs:
113113
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
114114
run: |
115115
set -exu
116-
PR_TITLE="Mergeback $VERSION $HEAD_BRANCH into $BASE_BRANCH"
117-
PR_BODY="Updates version and changelog."
116+
pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
117+
pr_body="Updates version and changelog."
118118
119119
# Update the version number ready for the next release
120120
npm version patch --no-git-tag-version
121121
122122
# Update the changelog
123123
perl -i -pe 's/^/## \[UNRELEASED\]\n\nNo user facing changes.\n\n/ if($.==3)' CHANGELOG.md
124124
git add .
125-
git commit -m "Update changelog and version after $VERSION"
125+
git commit -m "Update changelog and version after ${VERSION}"
126126
127-
git push origin "$NEW_BRANCH"
127+
git push origin "${NEW_BRANCH}"
128128
129129
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
130130
# so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
131131
gh pr create \
132-
--head "$NEW_BRANCH" \
133-
--base "$BASE_BRANCH" \
134-
--title "$PR_TITLE" \
132+
--head "${NEW_BRANCH}" \
133+
--base "${BASE_BRANCH}" \
134+
--title "${pr_title}" \
135135
--label "Update dependencies" \
136-
--body "$PR_BODY" \
136+
--body "${pr_body}" \
137137
--draft

0 commit comments

Comments
 (0)