Skip to content

Latest commit

Β 

History

History
32 lines (24 loc) Β· 846 Bytes

File metadata and controls

32 lines (24 loc) Β· 846 Bytes

Example: Get GitHub App access token in Bash

Dependencies are openssl, curl, jq and gh.

Prepare environment:

export GITHUB_APP_ID=...
export GITHUB_APP_PK_FILE=...
export GITHUB_ORG="nhs-england-tools"

Run script:

$ cd docs/adr/assets/ADR-003/examples/bash
$ ./script.sh
GITHUB_TOKEN=ghs_...

Check the token:

$ GITHUB_TOKEN=ghs_...; echo "$GITHUB_TOKEN" | gh auth login --with-token
$ gh auth status
github.com
  βœ“ Logged in to github.com as nhs-england-update-from-template[bot] (keyring)
  βœ“ Git operations for github.com configured to use https protocol.
  βœ“ Token: ghs_************************************

See the example (script.sh) implementation. This script has been written to illustrate the concept in a clear and simple way. It is not a production ready code.