commit 96dccc5ccc34af63f578b130444b050fee89ca11 Author: Devraj Mehta Date: Tue Mar 10 14:24:33 2026 -0400 💥 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6e42615 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bff3557 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a5ef66 --- /dev/null +++ b/README.md @@ -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) diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..71e0709 --- /dev/null +++ b/action.yml @@ -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"