Skip to content

Commit b82d8cd

Browse files
committed
tools: align Bash snippets in GHA with lint-sh conventions
Our shell scripts enforce passing arbitrary values via quoted env variables to avoid injections. Signed-off-by: Antoine du Hamel <[email protected]> PR-URL: #63829 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tierney Cyren <[email protected]>
1 parent d86c1d9 commit b82d8cd

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/comment-labeled.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
env:
3131
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
run: gh issue comment "$NUMBER" --repo ${{ github.repository }} --body "$STALE_MESSAGE"
33+
run: gh issue comment "$NUMBER" --repo "$GITHUB_REPOSITORY" --body "$STALE_MESSAGE"
3434

3535
fast-track:
3636
permissions:
@@ -41,7 +41,8 @@ jobs:
4141
- name: Request Fast-Track
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
run: gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$FAST_TRACK_MESSAGE"
44+
NUMBER: ${{ github.event.pull_request.number }}
45+
run: gh pr comment "$NUMBER" --repo "$GITHUB_REPOSITORY" --body "$FAST_TRACK_MESSAGE"
4546

4647
notable-change:
4748
permissions:
@@ -52,4 +53,5 @@ jobs:
5253
- name: Add notable change description
5354
env:
5455
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
run: gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$NOTABLE_CHANGE_MESSAGE"
56+
NUMBER: ${{ github.event.pull_request.number }}
57+
run: gh pr comment "$NUMBER" --repo "$GITHUB_REPOSITORY" --body "$NOTABLE_CHANGE_MESSAGE"

.github/workflows/label-flaky-test-issue.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,5 @@ jobs:
4949
env:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151
NUMBER: ${{ github.event.issue.number }}
52-
run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ steps.extract-labels.outputs.LABELS }}"
52+
LABELS: ${{ steps.extract-labels.outputs.LABELS }}
53+
run: gh issue edit "$NUMBER" --repo "$GITHUB_REPOSITORY" --add-label "$LABELS"

.github/workflows/linters.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ jobs:
227227
/tools/lint-pr-url.mjs
228228
/doc/api/
229229
sparse-checkout-cone-mode: false
230-
# GH Actions squashes all PR commits, HEAD^ refers to the base branch.
231-
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }}
230+
# We've checked out a merge commit, HEAD^ refers to the base branch.
231+
- run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs "$PR_URL"
232+
env:
233+
PR_URL: ${{ github.event.pull_request.html_url }}
232234
lint-readme:
233235
runs-on: ubuntu-slim
234236
steps:

0 commit comments

Comments
 (0)