Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

The gh extension install command fails in GitHub Actions without GH_TOKEN set. The install script attempts gh extension install as the primary installation method before falling back to direct binary download.

Changes

actions/setup-cli/action.yml

  • Add github-token input (optional, defaults to ${{ github.token }})
  • Pass token as GH_TOKEN environment variable to install.sh

actions/setup-cli/README.md

  • Document github-token input parameter and override usage

pkg/cli/setup_cli_action_integration_test.go

  • Add validation for github-token input, GH_TOKEN env var, and default value

Usage

Default behavior (no changes required for existing workflows):

- uses: githubnext/gh-aw/actions/setup-cli@v0.37.20
  with:
    version: v0.37.20

Override with custom token if needed:

- uses: githubnext/gh-aw/actions/setup-cli@v0.37.20
  with:
    version: v0.37.20
    github-token: ${{ secrets.CUSTOM_PAT }}
Original prompt

When generating the call to actions/setup-cli , it must have access to the github token. Add a field to the action to receive the github token and set the default to the github action secret.

See error message:

3s
Run githubnext/gh-aw/actions/setup-cli@v0.37.20
Run /home/runner/work/_actions/githubnext/gh-aw/v0.37.20/actions/setup-cli/install.sh
[INFO] Detected OS: Linux -> linux
[INFO] Detected architecture: x86_64 -> amd64
[INFO] Platform: linux-amd64
[INFO] Using specified version: v0.37.20
[INFO] Validating release v0.37.20 exists...
[INFO] Fetching release data (attempt 1/3)...
[SUCCESS] Release v0.37.20 validated
[INFO] Attempting to install gh-aw using 'gh extension install'...
gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
  env:
    GH_TOKEN: ${{ github.token }}
[WARNING] gh extension install completed but verification failed
[INFO] Falling back to manual installation...
[INFO] Download URL: https://github.com/githubnext/gh-aw/releases/download/v0.37.20/linux-amd64
[INFO] Installation directory: /home/runner/.local/share/gh/extensions/gh-aw
[INFO] Creating installation directory...
[INFO] Downloading gh-aw binary...

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add github-token input parameter with default value ${{ github.token }}
- Pass token as GH_TOKEN environment variable to install.sh
- Update README with usage examples for the new input
- Add test coverage for the github-token input in action.yml

This fixes the issue where gh extension install fails with "set the GH_TOKEN environment variable" error in GitHub Actions workflows.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add field for GitHub token in setup-cli action Add github-token input to setup-cli action Jan 26, 2026
Copilot AI requested a review from pelikhan January 26, 2026 01:54
@pelikhan pelikhan marked this pull request as ready for review January 26, 2026 01:59
@pelikhan pelikhan merged commit 3a6da41 into main Jan 26, 2026
50 checks passed
@pelikhan pelikhan deleted the copilot/add-github-token-field branch January 26, 2026 02:01
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