Skip to content

Fix: install gh-aw CLI before gh aw logs in copilot-token-audit and copilot-token-optimizer#31618

Closed
Copilot wants to merge 6 commits into
mainfrom
copilot/add-gh-aw-cli-install
Closed

Fix: install gh-aw CLI before gh aw logs in copilot-token-audit and copilot-token-optimizer#31618
Copilot wants to merge 6 commits into
mainfrom
copilot/add-gh-aw-cli-install

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Bug Fix

What was the bug?

copilot-token-audit and copilot-token-optimizer call gh aw logs in user-defined pre-steps but never install the extension first. The framework's own "Install gh-aw extension" step runs after user-defined steps in the compiled lock file, so downstream runners without the extension pre-installed hard-fail with unknown command "aw" for "gh" and fall through to the empty-data path.

How did you fix it?

Added an explicit "Install gh-aw CLI" step immediately before each gh aw logs call in both source .md files using the github/gh-aw-actions/setup-cli action (SHA-pinned). Both lock files were recompiled via gh aw compile after merging the latest main.

- name: Install gh-aw CLI
  uses: github/gh-aw-actions/setup-cli@28ffccfcaa92868c8160807f95519789a590defc # v0.74.0
  with:
    version: v0.74.0

Files changed:

  • copilot-token-audit.md — install step added before "Download Copilot workflow logs"
  • copilot-token-optimizer.md — install step added before "Download recent Copilot workflow logs"
  • copilot-token-audit.lock.yml / copilot-token-optimizer.lock.yml — recompiled with SHA-pinned action reference
  • .github/aw/actions-lock.json — updated with SHA for github/gh-aw-actions/setup-cli@v0.74.0

Audit of other workflows: ab-testing-advisor.md and daily-cli-tools-tester.md only reference gh aw in agent prompt text (not shell steps); daily-security-observability.md already had the install step.

Copilot AI and others added 2 commits May 12, 2026 02:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…nd copilot-token-optimizer

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add explicit installation of gh-aw CLI in upstream workflows Fix: install gh-aw CLI before gh aw logs in copilot-token-audit and copilot-token-optimizer May 12, 2026
Copilot AI requested a review from pelikhan May 12, 2026 02:46
Comment on lines +52 to +61
- name: Install gh-aw CLI
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh extension list | grep -q "github/gh-aw"; then
gh extension upgrade gh-aw || true
else
gh extension install github/gh-aw
fi
gh aw --version
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot

  • use github/gh-aw-actions/setup-cli instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched to github/gh-aw-actions/setup-cli in both workflows (pinned to v0.74.0, the current latest). Done in commit 8b3c8cf → the latest push.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan May 12, 2026 03:18
@pelikhan pelikhan marked this pull request as ready for review May 12, 2026 03:28
Copilot AI review requested due to automatic review settings May 12, 2026 03:28
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

@pelikhan
Copy link
Copy Markdown
Collaborator

@mnkiefer

Copy link
Copy Markdown
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

Fixes workflows that invoke gh aw logs in early/user-defined steps by ensuring the gh-aw CLI/extension is installed before the first gh aw invocation.

Changes:

  • Added an explicit “Install gh-aw CLI” step (using github/gh-aw-actions/setup-cli@v0.74.0) before gh aw logs in copilot-token-audit.md and copilot-token-optimizer.md.
  • Recompiled the corresponding .lock.yml workflows to include the new step.
  • Also includes unrelated lockfile churn in blog-auditor.lock.yml and unbloat-docs.lock.yml (allowed-tools deduping).
Show a summary per file
File Description
.github/workflows/copilot-token-optimizer.md Installs gh-aw CLI before downloading workflow logs via gh aw logs.
.github/workflows/copilot-token-optimizer.lock.yml Recompiled lock to include the new install step (but includes resolution/pinning issues).
.github/workflows/copilot-token-audit.md Installs gh-aw CLI before downloading workflow logs via gh aw logs.
.github/workflows/copilot-token-audit.lock.yml Recompiled lock to include the new install step (but includes resolution/pinning issues).
.github/workflows/unbloat-docs.lock.yml Unrelated regeneration/deduping in allowed-tools list.
.github/workflows/blog-auditor.lock.yml Unrelated regeneration/deduping in allowed-tools list.

Copilot's findings

Tip

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

  • Files reviewed: 6/6 changed files
  • Comments generated: 4

# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"7430388914ae348ed20b0daad7f86ab4a28806a4cf32176948c289c430a73203","strict":true,"agent_id":"copilot"}
# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_ENDPOINT","GH_AW_OTEL_HEADERS","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"v6.2.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"bcafcacb16a39f128d818304e6c9c0c18556b85f","version":"v7.1.0"},{"repo":"docker/setup-buildx-action","sha":"4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd","version":"v4.0.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.43"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.6","digest":"sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c"},{"image":"ghcr.io/github/github-mcp-server:v1.0.3","digest":"sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]}
# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"10fa8e67ee28f2e2aecc36516c5632092383a92aabe122ba4aeb894aeea5bd55","strict":true,"agent_id":"copilot"}
# gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_ENDPOINT","GH_AW_OTEL_HEADERS","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/setup-python","sha":"a309ff8b426b58ec0e2a45f0f869d46889d02405","version":"v6.2.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"bcafcacb16a39f128d818304e6c9c0c18556b85f","version":"v7.1.0"},{"repo":"docker/setup-buildx-action","sha":"4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd","version":"v4.0.0"},{"repo":"github/gh-aw-actions/setup-cli","sha":"v0.74.0","version":"v0.74.0"}],"resolution_failures":[{"repo":"github/gh-aw-actions/setup-cli","ref":"v0.74.0","error_type":"dynamic_resolution_failed"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.43"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.6","digest":"sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c"},{"image":"ghcr.io/github/github-mcp-server:v1.0.3","digest":"sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]}
Comment on lines +1 to +2
# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"a62e25bcbd131263f0db28576af9a972cd8a4ec17af91407da4123d0938912b9","strict":true,"agent_id":"copilot"}
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_ENDPOINT","GH_AW_OTEL_HEADERS","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup-cli","sha":"v0.74.0","version":"v0.74.0"}],"resolution_failures":[{"repo":"github/gh-aw-actions/setup-cli","ref":"v0.74.0","error_type":"dynamic_resolution_failed"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.43"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.43"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.6","digest":"sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c"},{"image":"ghcr.io/github/github-mcp-server:v1.0.3","digest":"sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]}
Comment on lines 892 to 901
# Allowed tools (sorted):
# - Bash(awk)
# - Bash(cat /tmp/gh-aw/cache-memory/)
# - Bash(cat > /tmp/gh-aw/cache-memory/)
# - Bash(cat)
# - Bash(cat)
# - Bash(cd)
# - Bash(cp)
# - Bash(curl)
# - Bash(date)
# - Bash(date)
# - Bash(echo)
# - Bash(echo)
Comment on lines 738 to 744
- name: Execute Claude Code CLI
id: agentic_execution
# Allowed tools (sorted):
# - Bash(cat)
# - Bash(cat)
# - Bash(date)
# - Bash(date)
# - Bash(echo)
# - Bash(echo)
# - Bash(find * -maxdepth 1)
Copilot AI and others added 2 commits May 12, 2026 03:33
…-install

# Conflicts:
#	.github/workflows/blog-auditor.lock.yml
#	.github/workflows/unbloat-docs.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot merge main and recompile

Done. Merged main, recompiled both workflows — the setup-cli action is now SHA-pinned (28ffccfcaa92868c8160807f95519789a590defc # v0.74.0) in both lock files.

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.

Upstream workflows that shell out to gh aw should install the gh-aw CLI explicitly

3 participants