Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .config/cspell/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"GLIBCXX",
"libstdc",
"noproxy",
"pgrep"
"pgrep",
"varint"
]
}
27 changes: 27 additions & 0 deletions .github/workflows/github-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "GitHub CLI"

on:
pull_request:
paths:
- "features/github-cli/config.json"
push:
branches:
- main
paths:
- "features/github-cli/config.json"
workflow_dispatch:

concurrency:
group: "github-cli-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
verify:
uses: ./.github/workflows/verify.yml
permissions:
contents: write
packages: write
with:
feature: github-cli
binaries: false
scenarios: '["default"]'
2 changes: 1 addition & 1 deletion .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
feature: [dotnet, ripgrep, code-server, uv]
feature: [dotnet, ripgrep, code-server, uv, github-cli]
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v7
Expand Down
9 changes: 9 additions & 0 deletions features/github-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM scratch AS linux-amd64-base
FROM scratch AS linux-arm64-base

ARG TARGETOS
ARG TARGETARCH
FROM ${TARGETOS}-${TARGETARCH}-base
ARG TARGETOS
ARG TARGETARCH
COPY ${TARGETOS}/${TARGETARCH}/features/github-cli/ /features/github-cli/
11 changes: 11 additions & 0 deletions features/github-cli/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Installed files

| Source | Destination |
| --------------------------- | ---------------------------------------------------- |
| `bin/gh` | `/usr/local/bin/gh` |
| `share/man/man1/*.1` | `/usr/local/share/man/man1/` |
| `LICENSE` | `/usr/local/share/doc/gh/LICENSE` |
| `gh completion -s bash` | `/usr/local/share/bash-completion/completions/gh` |
| `gh completion -s zsh` | `/usr/local/share/zsh/site-functions/_gh` |
| `gh completion -s fish` | `/usr/local/share/fish/vendor_completions.d/gh.fish` |
| `export GH_TELEMETRY=false` | `/etc/profile.d/gh.sh` |
28 changes: 28 additions & 0 deletions features/github-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# GitHub CLI (github-cli)

Installs the GitHub CLI (gh).

## Example Usage

```dockerfile
FROM ghcr.io/devcontainer-config/features/github-cli AS github-cli

FROM base-image
COPY --from=github-cli /features/github-cli/ /opt/devcontainer-config/features/github-cli/
```

## Installed files

| Source | Destination |
| --------------------------- | ---------------------------------------------------- |
| `bin/gh` | `/usr/local/bin/gh` |
| `share/man/man1/*.1` | `/usr/local/share/man/man1/` |
| `LICENSE` | `/usr/local/share/doc/gh/LICENSE` |
| `gh completion -s bash` | `/usr/local/share/bash-completion/completions/gh` |
| `gh completion -s zsh` | `/usr/local/share/zsh/site-functions/_gh` |
| `gh completion -s fish` | `/usr/local/share/fish/vendor_completions.d/gh.fish` |
| `export GH_TELEMETRY=false` | `/etc/profile.d/gh.sh` |

---

_Note: This file was auto-generated from the [feature.json](https://github.com/devcontainer-config/features/blob/main/features/github-cli/feature.json). Add additional notes to a `NOTES.md`._
18 changes: 18 additions & 0 deletions features/github-cli/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"revision": 1,
"versions": {
"2.104.0": {
"linux-x64": {
"url": "https://github.com/cli/cli/releases/download/v2.104.0/gh_2.104.0_linux_amd64.tar.gz",
"sha256": "98cb101ad87dbbd3f6b2f2bfcbd43197ccd07643140121d8a9cfaa91eadbc24e"
},
"linux-arm64": {
"url": "https://github.com/cli/cli/releases/download/v2.104.0/gh_2.104.0_linux_arm64.tar.gz",
"sha256": "cb34cefc6f4e77b90731374a2b737516bb8f3033c6ca46aa949e5344f68069e3"
}
}
},
"aliases": {
"2.104.0": ["2.104", "2", "latest"]
}
}
6 changes: 6 additions & 0 deletions features/github-cli/feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "github-cli",
"name": "GitHub CLI",
"description": "Installs the GitHub CLI (gh).",
"image": "ghcr.io/devcontainer-config/features/github-cli"
}
37 changes: 37 additions & 0 deletions features/github-cli/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
set -e

mkdir -p /usr/local/bin
ln -sfn "$PWD/bin/gh" /usr/local/bin/gh

mkdir -p /usr/local/share/man/man1
cp -p share/man/man1/*.1 /usr/local/share/man/man1/

mkdir -p /usr/local/share/doc/gh
cp -p LICENSE /usr/local/share/doc/gh/LICENSE

temp=$(mktemp -d)
trap 'rm -rf "$temp"' EXIT
mkdir -p "$temp/home" "$temp/config" "$temp/state" "$temp/data" "$temp/cache"

completion() {
GH_TELEMETRY=false \
HOME="$temp/home" \
XDG_CONFIG_HOME="$temp/config" \
XDG_STATE_HOME="$temp/state" \
XDG_DATA_HOME="$temp/data" \
XDG_CACHE_HOME="$temp/cache" \
"$PWD/bin/gh" completion -s "$1"
}

mkdir -p /usr/local/share/bash-completion/completions
completion bash > /usr/local/share/bash-completion/completions/gh

mkdir -p /usr/local/share/zsh/site-functions
completion zsh > /usr/local/share/zsh/site-functions/_gh

mkdir -p /usr/local/share/fish/vendor_completions.d
completion fish > /usr/local/share/fish/vendor_completions.d/gh.fish

mkdir -p /etc/profile.d
printf '%s\n' 'export GH_TELEMETRY=false' > /etc/profile.d/gh.sh
Loading
Loading