A GitHub Action to install the GitHub CLI (gh
) on self-hosted runners with
support for multiple platforms and architectures.
- Multi-platform support: Linux, macOS, and Windows
- Multi-architecture support: amd64, arm64, and 386 (32-bit)
- Automatic archive format detection: tar.gz for Unix-like systems, ZIP for Windows
- Tool caching: Avoids re-downloading if the same version is already cached
- Version flexibility: Install latest version or specify a custom version
- Platform detection: Automatically detects the runner's platform and architecture
Platform | amd64 | arm64 | 386 |
---|---|---|---|
Linux | ✅ | ✅ | ✅ |
macOS | ✅ | ✅ | ❌ |
Windows | ✅ | ✅ | ✅ |
steps:
- name: Setup GitHub CLI
uses: v2d27/[email protected]
steps:
- name: Setup GitHub CLI
uses: v2d27/[email protected]
with:
version: 'latest' # Optional: specify GitHub CLI version (default: latest)
- Install dependencies:
npm install
- Make sure you have Node.js 20.x or later installed
Package the TypeScript for distribution:
npm run bundle
Run the test suite:
npm test
Run ESLint to check for code issues:
npm run lint
src/
- TypeScript source codemain.ts
- Main action logic with multi-platform supportindex.ts
- Entry point
__tests__/
- Unit testsdist/
- Generated JavaScript (do not edit manually)action.yml
- Action metadata and input/output definitions
Please make pull request to this source code at: https://github.com/v2d27/setup-gh-cli