Skip to content

Fix shellcheck SC2086 quoting issues in shell scripts#5310

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-shellcheck-quoting-issues
Dec 2, 2025
Merged

Fix shellcheck SC2086 quoting issues in shell scripts#5310
pelikhan merged 2 commits into
mainfrom
copilot/fix-shellcheck-quoting-issues

Conversation

Copilot AI commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Actionlint identified 5 shellcheck SC2086 warnings for unquoted variable expansions that could cause word splitting or glob expansion issues.

Changes

  • go-pattern-detector.md: Quote $GITHUB_PATH
  • release.md: Quote $GITHUB_OUTPUT, $GITHUB_ENV (3 occurrences), and file path in jq length command

Example

# Before
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV

# After
echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"

Fixes #5295

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Fix shellcheck quoting issues in shell scripts</issue_title>
<issue_description>## Objective

Add proper quotes around variable expansions in shell scripts to prevent word splitting and glob expansion issues.

Context

Priority: 🟡 Priority 3 (Code quality - potential runtime failures)

Actionlint identified 5 shellcheck SC2086 warnings across 2 workflows. Missing quotes around variables can cause unexpected behavior when variables contain spaces or special characters.

Affected Locations

go-pattern-detector.md

  • Line 4425:9 in "Install ast-grep" step (1 occurrence)

release.md

  • Line 464:9 in "Setup environment and fetch release data" step (3 occurrences at columns 36, 31, 48)
  • Line 5887:9 in "Get release ID" step (1 occurrence at column 34)

Pattern to Fix

# ❌ Before (unquoted)
gh release view $RELEASE_TAG
jq length $JSON_FILE
cd $DIRECTORY

# ✅ After (quoted)
gh release view "$RELEASE_TAG"
jq length "$JSON_FILE"
cd "$DIRECTORY"

Approach

  1. Review each affected line in the shell scripts
  2. Add double quotes around all variable expansions
  3. Ensure the changes don't break existing logic
  4. Test the modified workflows

Files to Modify

  • .github/workflows/go-pattern-detector.md (line ~4425)
  • .github/workflows/release.md (lines ~464, ~5887)

Acceptance Criteria

  • All variable expansions properly quoted
  • Actionlint scan passes without SC2086 warnings
  • Workflows compile successfully
  • Shell scripts execute correctly with quoted variables
  • No regression in workflow functionality

Testing

# Compile and validate both workflows
gh aw compile go-pattern-detector --actionlint
gh aw compile release --actionlint

Related to #5294

AI generated by Plan Command for discussion #5280

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Quote variable expansions to prevent word splitting and glob expansion:
- go-pattern-detector.md: Quote $GITHUB_PATH
- release.md: Quote $GITHUB_OUTPUT, $GITHUB_ENV, and file path in jq command

Fixes #5295

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix shellcheck quoting issues in shell scripts Fix shellcheck SC2086 quoting issues in shell scripts Dec 2, 2025
Copilot AI requested a review from pelikhan December 2, 2025 14:59
@pelikhan pelikhan marked this pull request as ready for review December 2, 2025 15:02
@pelikhan pelikhan merged commit 3076e3a into main Dec 2, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-shellcheck-quoting-issues branch December 2, 2025 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Fix shellcheck quoting issues in shell scripts [plan] Fix credential persistence vulnerability in release.md

2 participants