Skip to content

Commit 3629cbf

Browse files
authored
Use double quotes consistently for shell scripts (#14938)
## Summary The release failed (https://github.com/astral-sh/ruff/actions/runs/12298190472/job/34321509636) because the shell script in the Docker release workflow was using single quotes instead of double quotes. This is related to https://www.shellcheck.net/wiki/SC2016. I found it via [`actionlint`](https://github.com/rhysd/actionlint). Related #14893. I also went ahead and fixed https://www.shellcheck.net/wiki/SC2086 which were raised in a couple of places.
1 parent 37f4338 commit 3629cbf

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/build-docker.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
- name: Normalize Platform Pair (replace / with -)
7373
run: |
7474
platform=${{ matrix.platform }}
75-
echo "PLATFORM_TUPLE=${platform//\//-}" >> $GITHUB_ENV
75+
echo "PLATFORM_TUPLE=${platform//\//-}" >> "$GITHUB_ENV"
7676
7777
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
7878
- name: Build and push by digest
@@ -143,8 +143,8 @@ jobs:
143143
# The final command becomes `docker buildx imagetools create -t tag1 -t tag2 ... <RUFF_BASE_IMG>@sha256:<sha256_1> <RUFF_BASE_IMG>@sha256:<sha256_2> ...`
144144
run: |
145145
docker buildx imagetools create \
146-
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
147-
$(printf '${RUFF_BASE_IMG}@sha256:%s ' *)
146+
"$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \
147+
"$(printf "${RUFF_BASE_IMG}@sha256:%s " *)"
148148
149149
docker-publish-extra:
150150
name: Publish additional Docker image based on ${{ matrix.image-mapping }}
@@ -203,14 +203,14 @@ jobs:
203203
TAG_PATTERNS="${TAG_PATTERNS%\\n}"
204204
205205
# Export image cache name
206-
echo "IMAGE_REF=${BASE_IMAGE//:/-}" >> $GITHUB_ENV
206+
echo "IMAGE_REF=${BASE_IMAGE//:/-}" >> "$GITHUB_ENV"
207207
208208
# Export tag patterns using the multiline env var syntax
209209
{
210210
echo "TAG_PATTERNS<<EOF"
211211
echo -e "${TAG_PATTERNS}"
212212
echo EOF
213-
} >> $GITHUB_ENV
213+
} >> "$GITHUB_ENV"
214214
215215
- name: Extract metadata (tags, labels) for Docker
216216
id: meta
@@ -288,5 +288,5 @@ jobs:
288288
readarray -t lines <<< "$DOCKER_METADATA_OUTPUT_ANNOTATIONS"; annotations=(); for line in "${lines[@]}"; do annotations+=(--annotation "$line"); done
289289
docker buildx imagetools create \
290290
"${annotations[@]}" \
291-
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
292-
$(printf '${RUFF_BASE_IMG}@sha256:%s ' *)
291+
"$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \
292+
"$(printf "${RUFF_BASE_IMG}@sha256:%s " *)"

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ jobs:
268268
RELEASE_COMMIT: "${{ github.sha }}"
269269
run: |
270270
# Write and read notes from a file to avoid quoting breaking things
271-
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
271+
echo "$ANNOUNCEMENT_BODY" > "$RUNNER_TEMP/notes.txt"
272272
273-
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
273+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" "$PRERELEASE_FLAG" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
274274
275275
custom-notify-dependents:
276276
needs:

0 commit comments

Comments
 (0)