fix: install gh-aw CLI extension in workflow pre-steps#24335
Merged
Conversation
Multiple workflows using `./gh-aw logs` and `./gh-aw compile` in frontmatter `steps:` were silently failing because the gh-aw binary is not available in the runner's sparse-checkout working directory. The `steps:` run before the Copilot CLI and AWF are installed, and the runner only has a sparse checkout of the actions/ folder — no gh-aw binary exists at `./gh-aw`. Fix: Add an 'Install gh-aw CLI' step before data download steps and change `./gh-aw` to `gh aw` (extension invocation) in all affected workflows: - copilot-token-usage-analyzer - claude-token-usage-analyzer - copilot-token-optimizer - claude-token-optimizer - daily-copilot-token-report - daily-integrity-analysis - daily-syntax-error-quality - portfolio-analyst - static-analysis-report Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates several agentic workflow definitions so gh-aw is available during pre-agent steps: despite sparse checkouts, by installing the github/gh-aw GitHub CLI extension and switching invocations from ./gh-aw … to gh aw ….
Changes:
- Add a pre-step to install/upgrade the
gh-awGitHub CLI extension in each affected workflow. - Replace
./gh-aw logs|compile …withgh aw logs|compile …across the impacted workflows. - Remove local Go build steps for
gh-awwhere they were previously used only to provide a./gh-awbinary.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/static-analysis-report.md | Installs gh-aw extension before pre-steps; switches compile invocation to gh aw compile. |
| .github/workflows/static-analysis-report.lock.yml | Regenerated compiled workflow to include extension install step and updated compile command. |
| .github/workflows/portfolio-analyst.md | Installs gh-aw extension before downloading logs; switches to gh aw logs. |
| .github/workflows/portfolio-analyst.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/daily-syntax-error-quality.md | Replaces local build/./gh-aw usage with extension install and gh aw compile. |
| .github/workflows/daily-syntax-error-quality.lock.yml | Regenerated compiled workflow reflecting extension install and updated tool allowlist/commands. |
| .github/workflows/daily-integrity-analysis.md | Installs gh-aw extension before downloading integrity-filtered logs; switches to gh aw logs. |
| .github/workflows/daily-integrity-analysis.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/daily-copilot-token-report.md | Installs gh-aw extension before pre-downloading Copilot logs; switches to gh aw logs. |
| .github/workflows/daily-copilot-token-report.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/copilot-token-usage-analyzer.md | Installs gh-aw extension before downloading run data; switches to gh aw logs. |
| .github/workflows/copilot-token-usage-analyzer.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/copilot-token-optimizer.md | Installs gh-aw extension before loading run data; switches to gh aw logs. |
| .github/workflows/copilot-token-optimizer.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/claude-token-usage-analyzer.md | Installs gh-aw extension before downloading run data; switches to gh aw logs. |
| .github/workflows/claude-token-usage-analyzer.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
| .github/workflows/claude-token-optimizer.md | Installs gh-aw extension before loading run data; switches to gh aw logs. |
| .github/workflows/claude-token-optimizer.lock.yml | Regenerated compiled workflow reflecting extension install and updated logs command. |
Comments suppressed due to low confidence (4)
.github/workflows/copilot-token-usage-analyzer.md:62
gh aw logsfailures are currently silenced (2>/dev/null) and replaced with an empty JSON array, which can reintroduce the “silent noop report” behavior if the command errors (auth, rate limit, network, etc.). Consider preserving stderr (or printing a warning with the exit code) and failing the step when the download fails, so missing data is visible.
echo "📥 Downloading Copilot workflow runs from last 24 hours..."
gh aw logs \
--engine copilot \
--start-date -1d \
--json \
-c 300 \
> /tmp/token-analyzer/copilot-runs.json 2>/dev/null || echo "[]" > /tmp/token-analyzer/copilot-runs.json
.github/workflows/claude-token-usage-analyzer.md:62
gh aw logsfailures are currently silenced (2>/dev/null) and replaced with an empty JSON array, which can reintroduce the “silent noop report” behavior if the command errors (auth, rate limit, network, etc.). Consider preserving stderr (or printing a warning with the exit code) and failing the step when the download fails, so missing data is visible.
echo "📥 Downloading Claude workflow runs from last 24 hours..."
gh aw logs \
--engine claude \
--start-date -1d \
--json \
-c 300 \
> /tmp/token-analyzer-claude/claude-runs.json 2>/dev/null || echo "[]" > /tmp/token-analyzer-claude/claude-runs.json
.github/workflows/copilot-token-optimizer.md:70
gh aw logsfailures are currently silenced (2>/dev/null) and replaced with an empty JSON array, which can reintroduce the “silent noop report” behavior if the command errors (auth, rate limit, network, etc.). Consider preserving stderr (or printing a warning with the exit code) and failing the step when the download fails, so missing data is visible.
echo "📥 Loading Copilot workflow runs from last 24 hours..."
gh aw logs \
--engine copilot \
--start-date -1d \
--json \
-c 300 \
> /tmp/token-optimizer/copilot-runs.json 2>/dev/null || echo "[]" > /tmp/token-optimizer/copilot-runs.json
.github/workflows/claude-token-optimizer.md:70
gh aw logsfailures are currently silenced (2>/dev/null) and replaced with an empty JSON array, which can reintroduce the “silent noop report” behavior if the command errors (auth, rate limit, network, etc.). Consider preserving stderr (or printing a warning with the exit code) and failing the step when the download fails, so missing data is visible.
echo "📥 Loading Claude workflow runs from last 24 hours..."
gh aw logs \
--engine claude \
--start-date -1d \
--json \
-c 300 \
> /tmp/token-optimizer-claude/claude-runs.json 2>/dev/null || echo "[]" > /tmp/token-optimizer-claude/claude-runs.json
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lob update Recompile to match the updated bash tool pattern 'gh aw compile *' which was added via GitHub UI edit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Multiple workflows using
./gh-aw logsand./gh-aw compilein frontmattersteps:were silently failing because the gh-aw binary is not available in the runner's working directory.Root cause: The compiled workflow does a sparse checkout of only the
actions/folder. Thesteps:(pre-agent bash steps) run before the Copilot CLI/AWF install. There is no./gh-awbinary, so./gh-aw logs ... 2>/dev/null || echo "[]"silently produces empty results.Impact: The Copilot Token Usage Analyzer has been producing empty "noop" reports (e.g., run 23940898307) despite 100+ workflow runs in the preceding 24 hours. All 9 affected workflows have the same issue.
Fix
./gh-aw→gh aw(extension invocation) in all affected workflowsAffected Workflows (9)
copilot-token-usage-analyzergh aw logs --engine copilotclaude-token-usage-analyzergh aw logs --engine claudecopilot-token-optimizergh aw logs --engine copilotclaude-token-optimizergh aw logs --engine claudedaily-copilot-token-reportgh aw logs --engine copilotdaily-integrity-analysisgh aw logs --filtered-integritydaily-syntax-error-qualitygh aw compile(wasmake build && ./gh-aw)portfolio-analystgh aw logsstatic-analysis-reportgh aw compile --zizmor --poutine --actionlint