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
19 changes: 19 additions & 0 deletions actions/setup-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ The version of gh-aw to install. Must be a release tag.

- **Release tag**: e.g., `v0.37.18`, `v0.37.0`

### `github-token` (optional)

GitHub token for authentication. Used for both `gh` CLI operations and GitHub API calls.

- **Default**: `${{ github.token }}` (automatically provided by GitHub Actions)
- **Required**: No (uses the default GITHUB_TOKEN automatically)
- **When to override**: Only needed in special cases like using a PAT with additional permissions

## Outputs

### `installed-version`
Expand Down Expand Up @@ -134,6 +142,17 @@ jobs:
run: gh aw compile workflow.md
```

### Using a Custom GitHub Token

```yaml
- uses: githubnext/gh-aw/actions/setup-cli@main
with:
version: v0.37.18
github-token: ${{ secrets.MY_CUSTOM_TOKEN }}
```

**Note**: In most cases, you don't need to specify the `github-token` input. The action automatically uses `${{ github.token }}` which is provided by GitHub Actions.

## Troubleshooting

### "Release X does not exist"
Expand Down
5 changes: 5 additions & 0 deletions actions/setup-cli/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
version:
description: 'Version to install (release tag like v0.37.18)'
required: true
github-token:
description: 'GitHub token for authentication (used for gh CLI and API calls)'
required: false
default: ${{ github.token }}

outputs:
installed-version:
Expand All @@ -18,6 +22,7 @@ runs:
shell: bash
env:
INPUT_VERSION: ${{ inputs.version }}
GH_TOKEN: ${{ inputs.github-token }}
run: ${{ github.action_path }}/install.sh

branding:
Expand Down
14 changes: 14 additions & 0 deletions pkg/cli/setup_cli_action_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func TestSetupCLIActionYAML(t *testing.T) {
"installed-version:",
"runs:",
"using: 'composite'",
"github-token:",
}

for _, field := range requiredFields {
Expand All @@ -168,6 +169,19 @@ func TestSetupCLIActionYAML(t *testing.T) {
t.Errorf("version input should be required")
}

// Verify github-token has default value
if !strings.Contains(contentStr, "github-token:") {
t.Errorf("action.yml should define github-token input")
}
if !strings.Contains(contentStr, "default: ${{ github.token }}") {
t.Errorf("github-token should have default value of github.token")
}

// Verify GH_TOKEN environment variable is set
if !strings.Contains(contentStr, "GH_TOKEN:") {
t.Errorf("action.yml should set GH_TOKEN environment variable")
}

// Verify no SHA mention (only release tags)
if strings.Contains(strings.ToLower(contentStr), "sha") && !strings.Contains(contentStr, "SHA256") {
t.Errorf("action.yml should not mention SHA support (only release tags)")
Expand Down
Loading