Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions src/github-cli/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
This Feature supports Debian/Ubuntu-based distributions using the `apt` package manager, and Alpine Linux using `apk`.

`bash` is required to execute the `install.sh` script.
The base image is identified from `/etc/os-release`, using `ID` first and then each entry of `ID_LIKE`, so derivatives are covered by the
distribution they declare themselves to be like — Kali, Raspbian, Pop!\_OS and Zorin all resolve to the Debian installer. On a distribution
that is not yet supported, the Feature stops with a message naming the base image rather than failing part-way through an install.

> [!NOTE]
> `bash` is required to execute the `install.sh` script on Debian-based distros. Debian-based images *generally* provide `bash` by default,
> but if you're using one that does not please note that you'll need to ensure it's installed *before* the `github-cli` feature installer
> runs.
>
> On Alpine-based distros, `bash` is only needed when `extensions` option is set and is installed automatically in that case. Please note
> that this does mean that `bash` will be present in the container if you use the `extensions` option on Alpine images.

### Choosing an installation source

`installDirectlyFromGitHubRelease` selects where the GitHub CLI is installed from:

| | `true` (default) | `false` |
|---------------|--------------------------------------------------------------------|-------------------------------------------------------------------|
| Debian/Ubuntu | the `.deb` published with each GitHub release | GitHub's own apt repository at `cli.github.com` |
| Alpine | the statically linked `.tar.gz` published with each GitHub release | the `github-cli` package in Alpine's `community` repository [ref] |

[ref]: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#alpine-linux

Alpine's `community` repository carries a single version of `github-cli`, so a specific `version` cannot be honored when
`installDirectlyFromGitHubRelease` is `false`; it is ignored with a warning. Leave the option at its default to pin a version on Alpine.

## Extensions

If you set the `extensions` option, the feature will install each comma-separated entry. Extensions are installed for the most appropriate non-root user (based on `USERNAME` / `_REMOTE_USER`), with a fallback to `root`.
If you set the `extensions` option, the feature will install each comma-separated entry. Extensions are installed for the most appropriate
non-root user (based on `USERNAME` / `_REMOTE_USER`), with a fallback to `root`.

Private extensions can be installed when `GH_TOKEN` or `GITHUB_TOKEN` is available during feature installation. The token is forwarded to the selected non-root user and used through the GitHub CLI Git credential helper.
Private extensions can be installed when `GH_TOKEN` or `GITHUB_TOKEN` is available during feature installation. The token is forwarded to
the selected non-root user and used through the GitHub CLI Git credential helper.
50 changes: 42 additions & 8 deletions src/github-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# GitHub CLI (github-cli)

Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.
Expand All @@ -12,18 +13,51 @@ Installs the GitHub CLI. Auto-detects latest version and installs needed depende

## Options

| Options Id | Description | Type | Default Value |
| -------------------------------- | --------------------------------------------------------------------------------------------------- | ------- | ------------- |
| version | Select version of the GitHub CLI, if not latest. | string | latest |
| installDirectlyFromGitHubRelease | - | boolean | true |
| extensions | Comma-separated list of GitHub CLI extensions to install (e.g. 'dlvhdr/gh-dash,github/gh-copilot'). | string | |
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select version of the GitHub CLI, if not latest. | string | latest |
| installDirectlyFromGitHubRelease | Install from the binaries published with each GitHub release rather than a package repository. | boolean | true |
| extensions | Comma-separated list of GitHub CLI extensions to install (e.g. 'dlvhdr/gh-dash,github/gh-copilot'). | string | - |

## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
This Feature supports Debian/Ubuntu-based distributions using the `apt` package manager, and Alpine Linux using `apk`.

The base image is identified from `/etc/os-release`, using `ID` first and then each entry of `ID_LIKE`, so derivatives are covered by the
distribution they declare themselves to be like — Kali, Raspbian, Pop!\_OS and Zorin all resolve to the Debian installer. On a distribution
that is not yet supported, the Feature stops with a message naming the base image rather than failing part-way through an install.

> [!NOTE]
> `bash` is required to execute the `install.sh` script on Debian-based distros. Debian-based images *generally* provide `bash` by default,
> but if you're using one that does not please note that you'll need to ensure it's installed *before* the `github-cli` feature installer
> runs.
>
> On Alpine-based distros, `bash` is only needed when `extensions` option is set and is installed automatically in that case. Please note
> that this does mean that `bash` will be present in the container if you use the `extensions` option on Alpine images.

### Choosing an installation source

`installDirectlyFromGitHubRelease` selects where the GitHub CLI is installed from:

| | `true` (default) | `false` |
|---------------|--------------------------------------------------------------------|-------------------------------------------------------------------|
| Debian/Ubuntu | the `.deb` published with each GitHub release | GitHub's own apt repository at `cli.github.com` |
| Alpine | the statically linked `.tar.gz` published with each GitHub release | the `github-cli` package in Alpine's `community` repository [ref] |

[ref]: https://github.com/cli/cli/blob/trunk/docs/install_linux.md#alpine-linux

Alpine's `community` repository carries a single version of `github-cli`, so a specific `version` cannot be honored when
`installDirectlyFromGitHubRelease` is `false`; it is ignored with a warning. Leave the option at its default to pin a version on Alpine.

## Extensions

If you set the `extensions` option, the feature will install each comma-separated entry. Extensions are installed for the most appropriate
non-root user (based on `USERNAME` / `_REMOTE_USER`), with a fallback to `root`.

Private extensions can be installed when `GH_TOKEN` or `GITHUB_TOKEN` is available during feature installation. The token is forwarded to
the selected non-root user and used through the GitHub CLI Git credential helper.

`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/github-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/github-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
77 changes: 39 additions & 38 deletions src/github-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
{
"id": "github-cli",
"version": "1.1.2",
"name": "GitHub CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli",
"description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"none"
],
"default": "latest",
"description": "Select version of the GitHub CLI, if not latest."
},
"installDirectlyFromGitHubRelease": {
"type": "boolean",
"default": true
},
"extensions": {
"type": "string",
"default": "",
"description": "Comma-separated list of GitHub CLI extensions to install (e.g. 'dlvhdr/gh-dash,github/gh-copilot')."
}
"id": "github-cli",
"version": "1.2.0",
"name": "GitHub CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli",
"description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"none"
],
"default": "latest",
"description": "Select version of the GitHub CLI, if not latest."
},
"customizations": {
"vscode": {
"settings": {
"github.copilot.chat.codeGeneration.instructions": [
{
"text": "This dev container includes the GitHub CLI (`gh`), which is pre-installed and available on the `PATH`. IMPORTANT: `gh api -f` does not support object values, use multiple `-f` flags with hierarchical keys and string values instead. When using GitHub actions `actions/upload-artifact` or `actions/download-artifact` use v4 or later."
}
]
}
}
"installDirectlyFromGitHubRelease": {
"type": "boolean",
"default": true,
"description": "Install from the binaries published with each GitHub release rather than a package repository."
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils",
"ghcr.io/devcontainers/features/git"
]
"extensions": {
"type": "string",
"default": "",
"description": "Comma-separated list of GitHub CLI extensions to install (e.g. 'dlvhdr/gh-dash,github/gh-copilot')."
}
},
"customizations": {
"vscode": {
"settings": {
"github.copilot.chat.codeGeneration.instructions": [
{
"text": "This dev container includes the GitHub CLI (`gh`), which is pre-installed and available on the `PATH`. IMPORTANT: `gh api -f` does not support object values, use multiple `-f` flags with hierarchical keys and string values instead. When using GitHub actions `actions/upload-artifact` or `actions/download-artifact` use v4 or later."
}
]
}
}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils",
"ghcr.io/devcontainers/features/git"
]
}
Loading