GitHub/GH Client: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with " gh api")
 
No edit summary
Line 1: Line 1:
== Doc ==
https://cli.github.com/manual/gh_api
== Login ==
=== GH_TOKEN ===
<pre>
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
  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

Revision as of 20:43, 1 December 2023

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