This commit is contained in:
Devraj Mehta
2026-03-10 14:24:33 -04:00
commit 96dccc5ccc
4 changed files with 153 additions and 0 deletions

26
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Copilot CLI
uses: ./
with:
version: latest
- name: Verify copilot is on PATH
run: which copilot
- name: Check version
run: copilot --version

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

59
README.md Normal file
View File

@@ -0,0 +1,59 @@
# setup-copilot
A GitHub Action to install the [GitHub Copilot CLI](https://github.com/github/copilot-cli) in your workflow.
## Usage
```yaml
steps:
- uses: actions/setup-copilot@v1
with:
version: "latest" # optional, defaults to "latest"
github-token: ${{ secrets.COPILOT_TOKEN }} # optional, defaults to github.token
- run: copilot --version
```
## Inputs
| Input | Description | Required | Default |
| -------------- | ------------------------------------------------- | -------- | ---------------- |
| `version` | Version to install (`latest`, `prerelease`, or a specific version like `1.0.0`) | No | `latest` |
| `github-token` | GitHub token for Copilot authentication | No | `github.token` |
## Outputs
| Output | Description |
| --------- | -------------------------------------- |
| `version` | The version of Copilot CLI installed |
## Examples
### Install latest version
```yaml
- uses: actions/setup-copilot@v1
```
### Install a specific version
```yaml
- uses: actions/setup-copilot@v1
with:
version: "1.2.3"
```
### Use with a custom token
```yaml
- uses: actions/setup-copilot@v1
with:
github-token: ${{ secrets.COPILOT_TOKEN }}
```
## How it works
This action uses the [official Copilot CLI install script](https://gh.io/copilot-install) to download and install the binary, with checksum verification. The binary is installed to the runner's tool cache and added to `PATH`.
## License
[MIT](LICENSE)

47
action.yml Normal file
View File

@@ -0,0 +1,47 @@
name: "Setup Copilot CLI"
description: "Install the GitHub Copilot CLI for use in GitHub Actions workflows"
branding:
icon: "terminal"
color: "blue"
inputs:
version:
description: "Version of Copilot CLI to install (e.g. '1.0.0', 'latest', 'prerelease')"
required: false
default: "latest"
github-token:
description: "GitHub token for Copilot authentication. Defaults to the workflow token."
required: false
default: ${{ github.token }}
outputs:
version:
description: "The version of Copilot CLI that was installed"
value: ${{ steps.version.outputs.version }}
runs:
using: "composite"
steps:
- name: Install Copilot CLI
shell: bash
env:
VERSION: ${{ inputs.version }}
PREFIX: ${{ runner.tool_cache }}/copilot
run: curl -fsSL https://gh.io/copilot-install | bash
- name: Add to PATH
shell: bash
run: echo "${{ runner.tool_cache }}/copilot/bin" >> "$GITHUB_PATH"
- name: Set GITHUB_TOKEN
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: echo "GITHUB_TOKEN=${GH_TOKEN}" >> "$GITHUB_ENV"
- name: Verify installation
id: version
shell: bash
run: |
copilot --version
echo "version=$(copilot --version | head -1)" >> "$GITHUB_OUTPUT"