Skip to content

fix: prevent double-value GITHUB_OUTPUT from grep -c with or pipe echo default - #14

Merged
IvanBern merged 1 commit into
mainfrom
fix/ci-output-format
Jul 31, 2026
Merged

fix: prevent double-value GITHUB_OUTPUT from grep -c with or pipe echo default#14
IvanBern merged 1 commit into
mainfrom
fix/ci-output-format

Conversation

@ailinter-dev

Copy link
Copy Markdown
Contributor

Problem

PR #44 (ROADMAP.md only) failed CI with:

##[error]Unable to process file command 'output' successfully.
##[error]Invalid format '0'

Root Cause

In the Extract Results step of .github/actions/ailinter-check:

SECRETS=$(grep -cE '...' file 2>/dev/null || echo 0)

grep -c with no matches outputs 0 to stdout and exits with code 1. The || echo 0 fallback then outputs another 0. The captured value becomes 0\n0 (two lines).

Then echo secrets-found=${SECRETS} >> ${GITHUB_OUTPUT} writes:

secrets-found=0
0

The second lone 0 is not a valid key=value line → Invalid format '0'.

Fix

Changed || echo 0 to || VAR=0 — the fallback sets the variable directly without extra stdout.

Applies to both ISSUES and SECRETS variables.

Verification

# FIX:
result=$(grep -cE 'nonexistent' file) || result=0
echo $result → 0 (single line ✓)

Fixes CI failure on PRs with only non-Go files.

…ault

Bug:  outputs '0' and exits code 1 when no matches found.
The  fallback then outputs another '0', creating a
two-line value (0\n0) that gets written to GITHUB_OUTPUT as:
  secrets-found=0
  0
This is invalid GitHub Actions output format — second lone '0'
triggers 'Invalid format' error.

Fix: use  pattern instead of , so the
captured stdout comes only from grep and the fallback sets the
variable directly without echoing.

Applies to both ISSUES and SECRETS variables in Extract Results.
@github-actions

Copy link
Copy Markdown

🔍 AILINTER Code Quality Report

Metric Value
Lowest Quality Score 100 / 100
Score Threshold 80 / 100
Code Quality Issues 0
Secrets Found 0

All AILINTER checks passed!


View full output in the workflow run.

@IvanBern
IvanBern merged commit 0a29fe2 into main Jul 31, 2026
13 checks passed
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.

2 participants