Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Resolves SC2129 shellcheck warnings by grouping consecutive redirects to the same file variable.

Changes

  • actions/setup/sh/start_mcp_gateway.sh - Grouped 3 consecutive $GITHUB_OUTPUT redirects
  • actions/setup/sh/start_safe_inputs_server.sh - Grouped 2 consecutive $GITHUB_OUTPUT redirects
  • actions/setup/sh/start_safe_outputs_server.sh - Grouped 2 consecutive $GITHUB_OUTPUT redirects
  • actions/setup/js/mcp_server_core.test.cjs - Updated test shell script to use grouped pattern

Pattern

# Before
echo "gateway-pid=$GATEWAY_PID" >> $GITHUB_OUTPUT
echo "gateway-port=${MCP_GATEWAY_PORT}" >> $GITHUB_OUTPUT
echo "gateway-api-key=${MCP_GATEWAY_API_KEY}" >> $GITHUB_OUTPUT

# After
{
  echo "gateway-pid=$GATEWAY_PID"
  echo "gateway-port=${MCP_GATEWAY_PORT}"
  echo "gateway-api-key=${MCP_GATEWAY_API_KEY}"
} >> $GITHUB_OUTPUT

No functional changes - redirects maintain identical behavior.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Fix SC2129 shellcheck warnings - group consecutive redirects</issue_title>
<issue_description>## Description

Static analysis identified 164 instances of SC2129 shellcheck warnings across workflow files. This style issue occurs when multiple consecutive commands redirect to the same file individually, rather than grouping them with { cmd1; cmd2; } >> file pattern.

While this is a style issue (not a security vulnerability), fixing it improves code quality and reduces shellcheck noise.

Current Pattern

echo "key1=value1" >> $GITHUB_OUTPUT
echo "key2=value2" >> $GITHUB_OUTPUT
echo "key3=value3" >> $GITHUB_OUTPUT

Recommended Pattern

{
  echo "key1=value1"
  echo "key2=value2"
  echo "key3=value3"
} >> $GITHUB_OUTPUT

Scope

  • Total instances: 164 across 148 workflow files
  • Pattern: Consecutive redirects to $GITHUB_OUTPUT, $GITHUB_STEP_SUMMARY, $GITHUB_ENV
  • Files affected: .github/workflows/*.md source files (not .lock.yml files)

Suggested Changes

  1. Identify affected workflows: Use grep to find all instances:

    grep -r ">> \$GITHUB_OUTPUT" .github/workflows/*.md
    grep -r ">> \$GITHUB_STEP_SUMMARY" .github/workflows/*.md
  2. Fix pattern: Group consecutive redirects to same file

    • Look for 2+ consecutive echo/printf statements to same file
    • Wrap them in { ...; } >> file block
  3. Recompile workflows: Run make recompile to regenerate .lock.yml files

  4. Validate: Run make lint to ensure shellcheck warnings are resolved

Files Affected

Multiple workflow files in .github/workflows/ (estimated 50-60 files based on 164 instances)

Examples from previous fixes:

  • .github/workflows/hourly-ci-cleaner.md (lines 72-77)
  • .github/workflows/smoke-copilot.md (lines 84-89)

Success Criteria

  • All SC2129 shellcheck warnings resolved (164 → 0)
  • Workflows recompiled with make recompile
  • make lint passes without SC2129 warnings
  • No functional changes to workflow behavior

Automation Opportunity

Consider creating a script to automatically detect and fix this pattern:

# Detect pattern: 2+ consecutive lines with same redirect
# Transform: wrap in { ...; } >> file block
# Apply: to all .md files in .github/workflows/

Source

Extracted from Static Analysis Report - February 8, 2026 (Discussion github/gh-aw#14568)

Priority

Low - Style improvement, not blocking, but reduces linting noise significantly

Estimated Effort

  • Manual fix: 2-3 days to review and fix 164 instances
  • Automated fix: 1 day to create script + validation

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 10, 2026, 5:27 AM UTC

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Changeset

  • Type: patch
  • Description: Grouped consecutive $GITHUB_OUTPUT redirects in MCP setup scripts and their tests to satisfy SC2129 shellcheck warnings.

Generated by Changeset Generator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SC2129 shellcheck warnings in workflow files Fix SC2129: group consecutive redirects in shell scripts Feb 9, 2026
Copilot AI requested a review from pelikhan February 9, 2026 05:48
@pelikhan pelikhan added the smoke label Feb 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🧪 Smoke Project is now testing project operations...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Changeset Generator completed successfully!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Agent Container Tool Check ❌

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.52.2
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.12
java CRITICAL: Binary executing as bash
dotnet CRITICAL: Binary executing as bash

Result: 10/12 tools available ⚠️

Critical Issue Detected

Problem: Java and .NET binaries are executing as bash instead of their actual programs.

Evidence:

  • java binary located at /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java
  • dotnet binary located at /usr/share/dotnet/dotnet
  • Both binaries exist and are executable (ELF format)
  • When invoked, they execute as bash and return bash version instead
  • Error message for dotnet: Error: cannot execute dotnet when renamed to bash.

Shell Environment:

  • Shell: /bin/bash
  • Fatal error when checking $0: fatal library error, lookup self

Impact: Agent container environment has a critical shell/binary execution issue that prevents Java and .NET tools from functioning correctly.

Recommendation: Investigate container image setup and shell configuration. This appears to be a binfmt or shell wrapper issue affecting binary execution.

AI generated by Agent Container Smoke Test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Smoke Project completed successfully. All project operations validated.

@pelikhan pelikhan marked this pull request as ready for review February 9, 2026 05:55
Copilot AI review requested due to automatic review settings February 9, 2026 05:55
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Merged PR titles:

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Smoke Test Results: ✅ PASS

Run: §21813947500

@app/copilot-swe-agent

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan merged commit 661d424 into main Feb 9, 2026
8 checks passed
@pelikhan pelikhan deleted the copilot/fix-sc2129-shellcheck-warnings branch February 9, 2026 05:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces ShellCheck SC2129 warnings by grouping consecutive redirects to the same GitHub Actions output file in MCP-related setup shell scripts and aligns a related test fixture with the same redirect grouping pattern.

Changes:

  • Grouped consecutive >> $GITHUB_OUTPUT writes into { ... } >> "$GITHUB_OUTPUT" blocks in MCP setup shell scripts.
  • Updated the MCP server core test fixture shell script to use the grouped redirect pattern.
  • Added a changeset documenting the patch-level change.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
actions/setup/sh/start_mcp_gateway.sh Groups gateway outputs into a single redirected block (SC2129 fix).
actions/setup/sh/start_safe_inputs_server.sh Groups port/api_key outputs into a single redirected block (SC2129 fix).
actions/setup/sh/start_safe_outputs_server.sh Groups port/api_key outputs into a single redirected block (SC2129 fix).
actions/setup/js/mcp_server_core.test.cjs Updates embedded shell script fixture to use grouped redirects.
.changeset/patch-group-github-output-redirects.md Records the patch changeset for the redirect grouping update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +426 to +430
{
echo "gateway-pid=$GATEWAY_PID"
echo "gateway-port=${MCP_GATEWAY_PORT}"
echo "gateway-api-key=${MCP_GATEWAY_API_KEY}"
} >> $GITHUB_OUTPUT
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redirect target is unquoted (} >> $GITHUB_OUTPUT). In this repo’s setup scripts we generally quote GitHub-provided file path vars (e.g. "$GITHUB_OUTPUT") to avoid SC2086-style word splitting/globbing and to keep output handling consistent with the other start_* scripts updated in this PR.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Fix SC2129 shellcheck warnings - group consecutive redirects

2 participants