https://github.com/sunggun-yu/gh-app-access-token
Simple Cli tool for operating Github App Installation access token
https://github.com/sunggun-yu/gh-app-access-token
cli github-app github-app-token github-token github-tokens-generator
Last synced: 5 months ago
JSON representation
Simple Cli tool for operating Github App Installation access token
- Host: GitHub
- URL: https://github.com/sunggun-yu/gh-app-access-token
- Owner: sunggun-yu
- License: mit
- Created: 2022-10-21T05:39:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-01-28T12:55:53.000Z (6 months ago)
- Last Synced: 2026-01-29T05:27:09.058Z (6 months ago)
- Topics: cli, github-app, github-app-token, github-token, github-tokens-generator
- Language: Go
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gh-app-access-token-cli

[](https://github.com/sunggun-yu/gh-app-access-token/actions/workflows/codeql.yaml)
Simple Cli tool for operating Github App Installation access token:
- create an access token
- revoke an access token
,with simply wrapping cli functionality on top of and
## Installation
brew:
```bash
brew install sunggun-yu/tap/gh-app-access-token
```
go install:
```bash
go install github.com/sunggun-yu/gh-app-access-token@
```
docker:
```bash
docker pull ghcr.io/sunggun-yu/gh-app-access-token:latest
```
shell script:
```bash
curl -sfL https://raw.githubusercontent.com/sunggun-yu/gh-app-access-token/main/install.sh | sh
```
it place `gh-app-access-token` in `/tmp` directory. please set `INSTALL_PATH` env var to change directory
```bash
export INSTALL_PATH=/
curl -sfL https://raw.githubusercontent.com/sunggun-yu/gh-app-access-token/main/install.sh | sh
```
or,
```bash
curl -sfL https://raw.githubusercontent.com/sunggun-yu/gh-app-access-token/main/install.sh | INSTALL_PATH=/ sh
```
## Usage
### Generate a Github App access token
```bash
# generate the Github App access token
gh-app-access-token generate \
--app-id [app-id] \
--installation-id [installation-id] \
--private-key [private-key-file-path]
# generate the Github App access token with file in HOME
gh-app-access-token generate \
--app-id [app-id] \
--installation-id [installation-id] \
--private-key $HOME/private-key.pem
# generate the Github App access token with file in HOME
gh-app-access-token generate \
--app-id [app-id] \
--installation-id [installation-id] \
--private-key ~/private-key.pem
# generate the Github App access token with text in private key file passed into stdin
cat [private-key-file-path] | gh-app-access-token generate \
--app-id [app-id] \
--installation-id [installation-id] \
--private-key -
# generate the Github App access token with private key text passed into stdin
echo "private-key-text" | gh-app-access-token generate \
--app-id [app-id] \
--installation-id [installation-id] \
--private-key -
```
### Generate a Github App access toekn using docker image
```bash
docker run --rm \
-v :/private-key.pem \
ghcr.io/sunggun-yu/gh-app-access-token:latest \
generate --app-id [app-id] --installation-id [installation-id] -f /private-key.pem
```
Use environemnt variable: e.g. run it on circleci or github actions
>⚠️ Note
>
> base64 encoded private key should be set in the environment variable
```bash
docker run --rm --entrypoint="/bin/sh" \
ghcr.io/sunggun-yu/gh-app-access-token:latest \
-c \
"echo -e $GH_APP_PRIVATE_KEY | base64 -d | \
gh-app-access-token generate \
--app-id $GH_APP_ID \
--installation-id $GH_APP_INSTALLATION_ID \
-f -"
```
>⚠️ Note/Warning
>
> it keeps waiting(hang) if there is no stdin when you pass `-` for arg/value
### Revoke the Github App access token
```bash
# revoke token in argument
gh-app-access-token-cli revoke [access token string]
# revoke the token passed into stdin
cat [access-token-file] | gh-app-access-token-cli revoke -
# revoke the token passed into stdin
echo "access-token-value" | gh-app-access-token-cli revoke -
```
>⚠️ Note/Warning
>
> it keeps waiting(hang) if there is no stdin when you pass `-` for arg/value
### Revoke the Github App access token using docker image
```bash
docker run --rm \
ghcr.io/sunggun-yu/gh-app-access-token:latest \
revoke [access token string]
```