Skip to content

Commit 03b343e

Browse files
Fix shell injection in update-changelog workflow for PR titles with backticks (#897)
PR titles containing backticks (e.g., "Remove `v` prefix from release tags") cause the changelog workflow to fail with `v: command not found` because bash interprets backticks as command substitution. ### Changes - Move variable assignments from `run:` to `env:` block in the "Update CHANGELOG.md" step ### Before ```yaml run: | PR_TITLE="${{ github.event.pull_request.title }}" # Backticks interpreted by bash ``` ### After ```yaml env: PR_TITLE: ${{ github.event.pull_request.title }} # Set by GHA before shell runs run: | ./bin/update-changelog.sh "$PR_TITLE" ... ``` Using the `env:` block ensures GitHub Actions sets environment variables before the shell executes, preventing interpretation of special characters. <!-- START COPILOT CODING AGENT TIPS --> --- 📱 Kick off Copilot coding agent tasks wherever you are with [GitHub Mobile](https://gh.io/cca-mobile-docs), available on iOS and Android. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
1 parent 0b390a7 commit 03b343e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/update-changelog.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ jobs:
5858
echo "Determined category: $CATEGORY"
5959
6060
- name: "Update CHANGELOG.md"
61+
env:
62+
PR_TITLE: ${{ github.event.pull_request.title }}
63+
PR_NUMBER: ${{ github.event.pull_request.number }}
64+
CATEGORY: ${{ steps.category.outputs.category }}
65+
GITHUB_REPOSITORY_URL: "https://github.com/${{ github.repository }}"
6166
run: |
62-
PR_TITLE="${{ github.event.pull_request.title }}"
63-
PR_NUMBER="${{ github.event.pull_request.number }}"
64-
CATEGORY="${{ steps.category.outputs.category }}"
65-
6667
# Use the standalone script to update the changelog
67-
export GITHUB_REPOSITORY_URL="https://github.com/${{ github.repository }}"
6868
./bin/update-changelog.sh "$PR_TITLE" "$PR_NUMBER" "$CATEGORY"
6969
7070
- name: "Commit and push changes"

0 commit comments

Comments
 (0)