Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

Adds actions/setup-cli to install gh-aw CLI extension by release tag with fallback installation strategies and checksum verification.

New Action

actions/setup-cli/

  • Mandatory version input: accepts release tags (e.g., v0.37.18)
  • Installation strategy: attempts gh extension install first, falls back to direct binary download
  • SHA256 checksum verification: Validates downloaded binaries for security
  • Outputs: installed-version for workflow consumption
- uses: githubnext/gh-aw/actions/setup-cli@v0.37.18
  with:
    version: v0.37.18

Enhanced install-gh-aw.sh

Added capabilities while maintaining backward compatibility:

  • INPUT_VERSION: reads version from environment for GitHub Actions integration
  • --gh-install: flag to enable gh extension install attempt
  • Release validation via GitHub API before installation
  • Checksum validation: Enabled automatically in GitHub Actions context (SKIP_CHECKSUM=false when INPUT_VERSION is set)
  • GITHUB_OUTPUT: writes installed_version for action outputs

Build Integration

Makefile

  • New sync-action-scripts target copies install-gh-aw.shactions/setup-cli/install.sh
  • Runs automatically during make build
  • Marks actions/setup-cli/install.sh as linguist-generated=true in .gitattributes

Copilot Setup Integration

Action Mode Support for copilot-setup-steps.yml

  • Modified pkg/cli/copilot_setup.go to generate different YAML based on action mode:
    • Release mode: Uses githubnext/gh-aw/actions/setup-cli@{version} with dynamic version from GetVersion()
    • Dev mode: Uses curl to download install-gh-aw.sh (backward compatible)
  • Updated ensureCopilotSetupSteps() to accept action mode and version parameters
  • Enhanced injectExtensionInstallStep() to inject appropriate steps for each mode with dynamic versioning
  • Supports updating existing .yml files with new action syntax
  • Dynamic versioning: Both action reference tag and version parameter use GetVersion() in release mode

Example outputs:

Release mode (using GetVersion() = "v1.2.3"):

- uses: githubnext/gh-aw/actions/setup-cli@v1.2.3
  with:
    version: v1.2.3

Dev mode:

- run: curl -fsSL https://raw.githubusercontent.com/githubnext/gh-aw/refs/heads/main/install-gh-aw.sh | bash

Testing

  • Shell script tests: 6 validation tests in actions/setup-cli/install_test.sh
  • Integration test: Added pkg/cli/setup_cli_action_integration_test.go with 8 test cases covering script syntax, INPUT_VERSION support, gh extension install logic, release validation, checksum enablement, and sync verification
  • Copilot setup tests: 15 comprehensive tests covering:
    • File creation (release/dev modes)
    • File updates (release/dev modes)
    • Skip logic when install already exists
    • Step injection with dynamic versioning
    • All create/update scenarios
  • Total: 29 tests, all passing ✅
Original prompt

Create a new action folder actions/setup-cli that installs the gh-aw extension for a given version (tag). The version field is mandatory and must be a release tag or a long sha that can be resolved back to a release

  • install.sh should support long sha as well
  • validates release still exists
  • attempts to install using "gh extensions install ..." if failing uses install.sh to do the download

the build should copy install.sh in the action folder, mark as git attribute generated


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 24, 2026 16:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add action folder setup-cli for gh-aw extension installation Add setup-cli action for installing gh-aw CLI by version or SHA Jan 24, 2026
Copilot AI requested a review from pelikhan January 24, 2026 17:03
@pelikhan
Copy link
Contributor

@copilot do not support long sha, only releases tags

@pelikhan
Copy link
Contributor

@copilot the install.sh script should do a checksum validation

@pelikhan
Copy link
Contributor

@copilot add integration test

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

Copilot AI commented Jan 24, 2026

@copilot do not support long sha, only releases tags

Removed SHA support. The action now only accepts release tags. Commit: 3fef50e

Copilot AI changed the title Add setup-cli action for installing gh-aw CLI by version or SHA Add setup-cli action for installing gh-aw CLI by release tag Jan 24, 2026
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 24, 2026

@copilot the install.sh script should do a checksum validation

Enabled checksum validation for GitHub Actions context. When INPUT_VERSION is set, SKIP_CHECKSUM is now set to false. Commit: 46995e9

@copilot add integration test

Added integration test in pkg/cli/setup_cli_action_integration_test.go with 8 test cases covering script syntax, INPUT_VERSION support, gh extension install logic, release validation, checksum enablement, and sync verification. All tests passing. Commit: 46995e9

@pelikhan
Copy link
Contributor

Use the current action mode to decide how to generate the steps in the copilot setup step .yml file. In release mode, it should use the new GitHub action.

Update the copilot step setup configuration code to support updating an existing .yml file with the new step syntax.

@pelikhan
Copy link
Contributor

@copilot Use the current action mode to decide how to generate the steps in the copilot setup step .yml file. In release mode, it should use the new GitHub action.

Update the copilot step setup configuration code to support updating an existing .yml file with the new step syntax.

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

Copilot AI commented Jan 24, 2026

@copilot Use the current action mode to decide how to generate the steps in the copilot setup step .yml file. In release mode, it should use the new GitHub action.

Update the copilot step setup confi...

Implemented action mode support. In release mode, copilot-setup-steps.yml now uses githubnext/gh-aw/actions/setup-cli@main with checkout step. In dev mode, it uses the curl method. Updated ensureCopilotSetupSteps() and injectExtensionInstallStep() to accept action mode parameter. Added tests for both modes. Commit: 8efae96

@pelikhan
Copy link
Contributor

@copilot the copilot template should use the release tag for the action and the version . See release tag constant

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

Copilot AI commented Jan 24, 2026

@copilot the copilot template should use the release tag for the action and the version . See release tag constant

Updated to use GetVersion() dynamically for both the action reference tag and version parameter. In release mode, generates githubnext/gh-aw/actions/setup-cli@{version} with version: {version}. In dev mode, uses @main. Commit: efe9402

@pelikhan
Copy link
Contributor

@copilot add tests for create/update copilot step file tests.

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

Copilot AI commented Jan 24, 2026

@copilot add tests for create/update copilot step file tests.

Added 8 new comprehensive test cases for create/update scenarios:

  • TestEnsureCopilotSetupSteps_CreateWithReleaseMode - creates new file with release mode
  • TestEnsureCopilotSetupSteps_CreateWithDevMode - creates new file with dev mode
  • TestEnsureCopilotSetupSteps_UpdateExistingWithReleaseMode - updates existing file to release mode
  • TestEnsureCopilotSetupSteps_UpdateExistingWithDevMode - updates existing file to dev mode
  • TestEnsureCopilotSetupSteps_SkipsUpdateWhenActionExists - verifies no update when action already exists
  • TestEnsureCopilotSetupSteps_SkipsUpdateWhenCurlExists - verifies no update when curl install exists
  • TestInjectExtensionInstallStep_ReleaseMode - tests injection with release mode and dynamic version
  • TestInjectExtensionInstallStep_DevMode - tests injection with dev mode

Total: 15 copilot setup tests, all passing. Commit: f7c885c

@pelikhan pelikhan marked this pull request as ready for review January 24, 2026 23:13
@pelikhan pelikhan merged commit 99aafdd into main Jan 24, 2026
@pelikhan pelikhan deleted the copilot/add-setup-cli-action branch January 24, 2026 23:18
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