Update bash style to quote variables and use [[ and $()

This commit is contained in:
Steve Repsher 2022-12-21 14:01:39 +00:00
parent 49e2230fb2
commit 997455932f
No known key found for this signature in database
GPG Key ID: 776C4F2DACF6131B

View File

@ -53,26 +53,26 @@ jobs:
git config user.email "github-action@users.noreply.github.com" git config user.email "github-action@users.noreply.github.com"
git add yarn.lock git add yarn.lock
git commit -m "Deduplicate dependencies" || exit 0 git commit -m "Deduplicate dependencies" || exit 0
git push origin HEAD:$GITHUB_HEAD_REF git push origin "HEAD:${GITHUB_HEAD_REF}"
echo "DEDUPED=true" >> $GITHUB_ENV echo "DEDUPED=true" >> "${GITHUB_ENV}"
- name: Output updated SHA for merge commit - name: Output updated SHA for merge commit
id: get-sha id: get-sha
shell: bash shell: bash
timeout-minutes: 15 timeout-minutes: 15
run: | run: |
if [ -v DEDUPED ]; then if [[ -v DEDUPED ]]; then
echo "Waiting for GitHub to do the mergability check and update the commit SHA..." echo "Waiting for GitHub to do the mergability check and update the commit SHA..."
while [ -z "$sha" -o "$sha" == "$GITHUB_SHA" ]; do while [[ -z "${sha}" || "${sha}" == "${GITHUB_SHA}" ]]; do
sleep 5s sleep 5s
sha=`git ls-remote origin $GITHUB_REF | awk '{print $1}'` sha=$(git ls-remote origin "${GITHUB_REF}" | awk '{print $1}')
done done
else else
echo "No deduplication required so using current merge commit SHA" echo "No deduplication required so using current merge commit SHA"
# Still need to query remote here in case of rerun where previous attempt was deduplicated # Still need to query remote here in case of rerun where previous attempt was deduplicated
sha=`git ls-remote origin $GITHUB_REF | awk '{print $1}'` sha=$(git ls-remote origin "${GITHUB_REF}" | awk '{print $1}')
fi fi
echo "Done - SHA is $sha" echo "Done - SHA is ${sha}"
echo "sha=$sha" >> $GITHUB_OUTPUT echo "sha=${sha}" >> "${GITHUB_OUTPUT}"
lint: lint:
name: Lint and check format name: Lint and check format
needs: dedupe needs: dedupe