Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pkg/workflow/js/*.cjs linguist-generated=true
pkg/workflow/sh/*.sh linguist-generated=true
actions/*/index.js linguist-generated=true
actions/setup-cli/install.sh linguist-generated=true
actions/setup-cli/install.ps1 linguist-generated=true
specs/artifacts.md linguist-generated=true merge=ours
docs/adr/*.md merge=theirs
# Use bd merge for beads JSONL files
Expand Down
84 changes: 81 additions & 3 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
paths:
- 'install-gh-aw.sh'
- 'install-gh-aw.ps1'
- 'scripts/test-install-script.sh'
- '.github/workflows/install.yml'

Expand Down Expand Up @@ -185,10 +186,87 @@ jobs:
echo ""
echo "✅ Full installation test passed!"

test-install-powershell:
name: Test PowerShell installer on Windows
runs-on: windows-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Capture platform-detection output (expects failure for fake version)
# The installer exits 1 when the nonexistent version download fails; that is
# expected. continue-on-error suppresses the step failure so the next step
# can assert the platform-detection messages that ran before the download.
continue-on-error: true
shell: pwsh
run: |
& ./install-gh-aw.ps1 v999.999.999 6>&1 2>&1 | Tee-Object -FilePath install-ps-output.log

- name: Assert platform-detection messages from dry run
shell: pwsh
run: |
Set-StrictMode -Version Latest
if (-not (Test-Path install-ps-output.log)) {
throw "Installer output file (install-ps-output.log) was not created; Tee-Object may have failed"
}
$outputText = Get-Content install-ps-output.log -Raw
if (-not $outputText) { throw "Installer output file (install-ps-output.log) exists but is empty" }
if ($outputText -notmatch "Detected OS:") { throw "OS detection failed" }
if ($outputText -notmatch "Detected architecture:") { throw "Architecture detection failed" }
if ($outputText -notmatch "Platform:") { throw "Platform string construction failed" }
if ($outputText -notmatch "Failed to download") { throw "Installer did not report expected download failure for fake version" }

- name: Test setup-cli composite action (Windows)
id: setup-cli-test
uses: ./actions/setup-cli
with:
version: latest
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Verify composite-action binary and installed-version output
shell: pwsh
run: |
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

$installedVersion = '${{ steps.setup-cli-test.outputs.installed-version }}'
if (-not $installedVersion) {
throw "installed-version output is empty; action output wiring is broken"
}
Write-Host "Composite action installed: $installedVersion"

# Verify via gh aw commands rather than a hardcoded binary path.
# `gh extension install` registers the extension under gh's own data dir
# (e.g. %APPDATA%\GitHub CLI\extensions on Windows), so using `gh aw`
# is the correct cross-platform verification mechanism.
gh aw version 2>&1 | Write-Host
if ($LASTEXITCODE -ne 0) {
throw "'gh aw version' failed with exit code $LASTEXITCODE"
}

gh aw --help 2>&1 | Write-Host
if ($LASTEXITCODE -ne 0) {
throw "'gh aw --help' failed with exit code $LASTEXITCODE"
}

- name: Upload PowerShell test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: install-test-powershell-windows
path: install-ps-output.log
retention-days: 7
if-no-files-found: ignore

report-failure:
name: Report Installation Failures
runs-on: ubuntu-latest
needs: test-install
needs:
- test-install
- test-install-powershell
if: failure()
permissions:
issues: write
Expand All @@ -211,7 +289,7 @@ jobs:

## Details

The install script testing workflow detected failures when testing the \`install-gh-aw.sh\` script across different platforms.
The install script testing workflow detected failures when testing the \`install-gh-aw.sh\` and \`install-gh-aw.ps1\` scripts across different platforms.

Please review the workflow logs to identify which platform(s) failed and investigate the issue.

Expand All @@ -225,7 +303,7 @@ jobs:
## Next Steps

1. Check the [workflow run logs](${workflowUrl}) for detailed error messages
2. Review changes to \`install-gh-aw.sh\` that may have caused the failure
2. Review changes to \`install-gh-aw.sh\` and \`install-gh-aw.ps1\` that may have caused the failure
3. Test the install script locally on the affected platform(s)
4. Fix the issue and verify with \`scripts/test-install-script.sh\`

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,8 @@ sync-action-scripts:
@echo "Syncing install-gh-aw.sh to actions/setup-cli/install.sh..."
@cp install-gh-aw.sh actions/setup-cli/install.sh
@chmod +x actions/setup-cli/install.sh
@echo "Syncing install-gh-aw.ps1 to actions/setup-cli/install.ps1..."
@cp install-gh-aw.ps1 actions/setup-cli/install.ps1
Comment thread
github-actions[bot] marked this conversation as resolved.
@echo "✓ Action scripts synced successfully"

# Sync install-gh-aw.sh SHA/hash constants in pkg/cli/copilot_setup.go
Expand Down Expand Up @@ -1219,7 +1221,7 @@ help:
@echo " check-stale-lock-files - Fast guard: detect modified .md files without regenerated .lock.yml (no binary needed)"
@echo " install - Install binary locally"
@echo " sync-action-pins - Sync actions-lock.json from .github/aw to pkg/actionpins/data and pkg/workflow/data (runs automatically during build)"
@echo " sync-action-scripts - Sync install-gh-aw.sh to actions/setup-cli/install.sh (runs automatically during build)"
@echo " sync-action-scripts - Sync install-gh-aw.sh and install-gh-aw.ps1 to actions/setup-cli/ (runs automatically during build)"
@echo " sync-install-script-hashes - Update install-gh-aw.sh SHA and SHA256 constants in pkg/cli/copilot_setup.go (runs automatically during update)"
@echo " update - Update GitHub Actions and workflows, sync action pins, and rebuild binary"
@echo " fix - Apply automatic codemod-style fixes to workflow files (depends on build)"
Expand Down
7 changes: 4 additions & 3 deletions actions/setup-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,18 @@ The action automatically falls back to direct download when `gh extension instal

## Development

This action is part of the gh-aw repository. The `install.sh` script is generated during the build process by copying from the root `install-gh-aw.sh` file.
This action is part of the gh-aw repository. The `install.sh` and `install.ps1` scripts are generated during the build process by copying from the root `install-gh-aw.sh` and `install-gh-aw.ps1` files.

### Building

The installation script is copied during the build process:
The installation scripts are copied during the build process:
Comment thread
github-actions[bot] marked this conversation as resolved.

```bash
make build # Copies install-gh-aw.sh to actions/setup-cli/install.sh
# and install-gh-aw.ps1 to actions/setup-cli/install.ps1
```

The generated `install.sh` file is marked as `linguist-generated=true` in `.gitattributes`.
The generated `install.sh` and `install.ps1` files are marked as `linguist-generated=true` in `.gitattributes`.

## License

Expand Down
15 changes: 14 additions & 1 deletion actions/setup-cli/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,24 @@ inputs:
outputs:
installed-version:
description: 'The version that was installed'
value: ${{ steps.install-windows.outputs.installed_version || steps.install-unix.outputs.installed_version }}

runs:
using: 'composite'
steps:
- name: Install gh-aw CLI
- name: Install gh-aw CLI (PowerShell)
id: install-windows
if: runner.os == 'Windows'
shell: pwsh
env:
INPUT_VERSION: ${{ inputs.version }}
GH_TOKEN: ${{ inputs.github-token }}
ACTION_PATH: ${{ github.action_path }}
run: '& "$env:ACTION_PATH/install.ps1"'
Comment thread
github-actions[bot] marked this conversation as resolved.

- name: Install gh-aw CLI (Bash)
id: install-unix
if: runner.os != 'Windows'
shell: bash
env:
INPUT_VERSION: ${{ inputs.version }}
Expand Down
Loading
Loading