GitHub/GH Client

From Omnia
Jump to navigation Jump to search

Doc

https://cli.github.com/manual/gh_api

Login

GH_TOKEN

PRIVATE_KEY='private_key.pem'
APP_ID='12345'
INSTALLATION_ID='54321'

JWT=`./make-jwt.py $PRIVATE_KEY $APP_ID`
GH_TOKEN=`curl -s --request POST --url "https://api.github.com/app/installations/$INSTALLATION_ID/access_tokens" --header "Accept: application/vnd.github+json" --header "Authorization: Bearer $JWT" --header "X-GitHub-Api-Version: 2022-11-28" | python -c "import sys, json; print(json.load(sys.stdin)['token'])"`
echo "export GH_TOKEN=$GH_TOKEN"

See make-jwt.py
 
 

api

gh api

Action Runners

https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28

List

gh api /orgs/ORG/actions/runners