-
Notifications
You must be signed in to change notification settings - Fork 542
Add feature for copilot-cli #1523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1e68faf
Add feature for copilot-cli
devm33 a2cd1fb
Add copilot-cli to CI workflows for testing
devm33 4ffb8b2
Add check for supported arch and fix remote name for amd64
devm33 d3d4738
Remove none
devm33 008ff14
Allow pinning a specific version
devm33 a6ae2bb
Add leading v for pinned versions
devm33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
|
|
||
| ## OS Support | ||
|
|
||
| This Feature should work on recent versions of Debian/Ubuntu-based distributions. | ||
|
|
||
| `bash` is required to execute the `install.sh` script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
|
|
||
| # GitHub Copilot CLI (copilot-cli) | ||
|
|
||
| Installs the GitHub Copilot CLI. Auto-detects latest version and installs needed dependencies. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```json | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/copilot-cli:1": {} | ||
| } | ||
| ``` | ||
|
|
||
| ## Options | ||
|
|
||
| | Options Id | Description | Type | Default Value | | ||
| |-----|-----|-----|-----| | ||
| | version | Select version of the GitHub Copilot CLI, if not latest. | string | latest | | ||
|
|
||
|
|
||
|
|
||
| ## OS Support | ||
|
|
||
| This Feature should work on recent versions of Debian/Ubuntu-based distributions. | ||
|
|
||
| `bash` is required to execute the `install.sh` script. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| _Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/copilot-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ | ||
devm33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "id": "copilot-cli", | ||
| "version": "1.0.0", | ||
| "name": "GitHub Copilot CLI", | ||
| "documentationURL": "https://github.com/devcontainers/features/tree/main/src/copilot-cli", | ||
| "description": "Installs the GitHub Copilot CLI.", | ||
| "options": { | ||
| "version": { | ||
| "type": "string", | ||
| "proposals": [ | ||
| "latest", | ||
| "prerelease" | ||
| ], | ||
| "default": "latest", | ||
AlvaroRausell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "Select version of the GitHub Copilot CLI, if not latest." | ||
| } | ||
| }, | ||
| "customizations": { | ||
| "vscode": { | ||
| "settings": { | ||
| "github.copilot.chat.codeGeneration.instructions": [ | ||
| { | ||
| "text": "This dev container includes the GitHub Copilot CLI (`copilot`), which is pre-installed and available on the `PATH`." | ||
devm33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "installsAfter": [ | ||
| "ghcr.io/devcontainers/features/common-utils" | ||
| ] | ||
| } | ||
|
|
||
devm33 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| #!/usr/bin/env bash | ||
| #------------------------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
| #------------------------------------------------------------------------------------------------------------- | ||
| # | ||
| # Docs: https://github.com/devcontainers/features/blob/main/src/copilot-cli/README.md | ||
| # Maintainer: The VS Code and Codespaces Teams | ||
|
|
||
| CLI_VERSION=${VERSION:-"latest"} | ||
|
|
||
| set -e | ||
|
|
||
| if [ "$(id -u)" -ne 0 ]; then | ||
| echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
| exit 1 | ||
| fi | ||
|
|
||
| apt_get_update() { | ||
| if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
| echo "Running apt-get update..." | ||
| apt-get update -y | ||
| fi | ||
| } | ||
|
|
||
| # Checks if packages are installed and installs them if not | ||
| check_packages() { | ||
| if ! dpkg -s "$@" > /dev/null 2>&1; then | ||
| apt_get_update | ||
| apt-get -y install --no-install-recommends "$@" | ||
| fi | ||
| } | ||
|
|
||
| download_from_github() { | ||
| local release_url=$1 | ||
| echo "Downloading GitHub Copilot CLI from ${release_url}..." | ||
|
|
||
| mkdir -p /tmp/copilotcli | ||
| pushd /tmp/copilotcli | ||
| wget --show-progress --progress=dot:giga ${release_url} | ||
| # curl -fL# -O ${release_url} | ||
| tar -xzf /tmp/copilotcli/${cli_filename} | ||
| mv copilot /usr/local/bin/copilot | ||
| popd | ||
| rm -rf /tmp/copilotcli | ||
| } | ||
|
|
||
| install_using_github() { | ||
| check_packages wget tar ca-certificates git | ||
| echo "Finished setting up dependencies" | ||
| arch=$(dpkg --print-architecture) | ||
| if [ "${arch}" = "amd64" ]; then | ||
| arch="x64" | ||
| fi | ||
| if [ "${arch}" != "x64" ] && [ "${arch}" != "arm64" ]; then | ||
| echo "Unsupported architecture: ${arch}" >&2 | ||
| exit 1 | ||
| fi | ||
| cli_filename="copilot-linux-${arch}.tar.gz" | ||
| echo "Installing GitHub Copilot CLI for ${arch} architecture: ${cli_filename}" | ||
|
|
||
| # Install latest | ||
| if [ "${CLI_VERSION}" = "latest" ]; then | ||
| download_from_github "https://github.com/github/copilot-cli/releases/latest/download/${cli_filename}" | ||
| elif [ "${CLI_VERSION}" = "prerelease" ]; then | ||
| prerelease_version="$(git ls-remote --tags https://github.com/github/copilot-cli | tail -1 | awk -F/ '{print $NF}')" | ||
| download_from_github "https://github.com/github/copilot-cli/releases/download/${prerelease_version}/${cli_filename}" | ||
| else | ||
| # Install specific version | ||
| # Add leading v to version if it doesn't start with v | ||
| if [[ ! "${CLI_VERSION}" =~ ^v[0-9] ]]; then | ||
| CLI_VERSION="v${CLI_VERSION}" | ||
| fi | ||
| download_from_github "https://github.com/github/copilot-cli/releases/download/${CLI_VERSION}/${cli_filename}" | ||
| fi | ||
| } | ||
|
|
||
| # Install the GitHub Copilot CLI | ||
| echo "Downloading GitHub Copilot CLI..." | ||
|
|
||
| install_using_github | ||
|
|
AlvaroRausell marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| echo "Checking if GitHub Copilot is installed..." | ||
| which copilot | ||
| copilot -v |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.