A GitHub Action to install the GitHub CLI (gh) on any runner platform with configurable version selection.
π Documentation: See
docs/for comprehensive documentation andexamples/for real-world workflow examples.
- π Install any version of the GitHub CLI
- π Automatically resolves the latest version
- π₯οΈ Cross-platform support (Linux, macOS, Windows)
- ποΈ Works with amd64, arm64, and 386 architectures
- β‘ Fast installation with caching support
- π Secure download from official GitHub releases
Install the latest version of the GitHub CLI:
steps:
- uses: actions/checkout@v4
- name: Setup GitHub CLI
uses: GitGoneWild/setup-gh-cli@v1
- name: Use gh CLI
run: gh --versionInstall a specific version:
steps:
- uses: actions/checkout@v4
- name: Setup GitHub CLI
uses: GitGoneWild/setup-gh-cli@v1
with:
version: '2.40.0'
- name: Use gh CLI
run: gh --versionProvide a token to avoid rate limiting when resolving the latest version:
steps:
- uses: actions/checkout@v4
- name: Setup GitHub CLI
uses: GitGoneWild/setup-gh-cli@v1
with:
version: 'latest'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Use gh CLI
run: gh --versionAccess the installed version and binary path:
steps:
- uses: actions/checkout@v4
- name: Setup GitHub CLI
id: setup-gh
uses: GitGoneWild/setup-gh-cli@v1
- name: Show installed version
run: |
echo "Installed version: ${{ steps.setup-gh.outputs.installed-version }}"
echo "Binary path: ${{ steps.setup-gh.outputs.gh-path }}"| Name | Description | Required | Default |
|---|---|---|---|
version |
Version of the GitHub CLI to install | No | latest |
token |
GitHub token for API requests (helps rate limiting) | No | ${{ github.token }} |
| Name | Description |
|---|---|
installed-version |
The version of the GitHub CLI that was installed |
gh-path |
The full path to the installed gh binary |
| OS | Architectures |
|---|---|
| Linux | amd64, arm64, 386 |
| macOS | amd64, arm64 |
| Windows | amd64, 386 |
- Python 3.9+
- pip
# Clone the repository
git clone https://github.com/GitGoneWild/setup-gh-cli.git
cd setup-gh-cli
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
# Run tests
pytest
# Run linting
ruff check src tests
mypy src# Set the version input (optional, defaults to 'latest')
export INPUT_VERSION="latest"
# Run the action
python -m src.setup_gh_cli.mainThis project is licensed under the MIT License - see the LICENSE file for details.
- Usage Guide - Getting started and usage patterns
- Configuration Reference - All inputs, outputs, and supported platforms
- CI/CD Integration - Patterns for integrating into pipelines
- Troubleshooting - Common issues and solutions
- Security & Support - Security practices and support policy
- Development Guide - For contributors
- Examples - Real-world workflow examples
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project uses an automated release workflow. Releases can be triggered manually via GitHub Actions.
- Go to Actions β Release workflow
- Click Run workflow
- Configure the release options:
- Version type: Choose
patch,minor, ormajorfor auto-increment - Custom version: Optionally specify an exact version (e.g.,
2.1.0) - Pre-release: Check to mark as pre-release
- Dry run: Check to test without creating a release
- Version type: Choose
| Current Version | Version Type | Next Version |
|---|---|---|
| v1.0.0 | patch | v1.0.1 |
| v1.0.0 | minor | v1.1.0 |
| v1.0.0 | major | v2.0.0 |
Each release automatically:
- Creates a version tag (e.g.,
v1.2.3) - Generates release notes from commits
- Updates the major version tag (e.g.,
v1) - Updates the
latesttag
For more details, see the Changelog Policy.
- GitHub CLI - The official GitHub command line tool
- GitHub Actions - GitHub's CI/CD platform