Skip to main content

Julia Evans

« back to all TILs

Setting secrets with the Github CLI is great

I’ve never used the GitHub gh CLI at all really but I learned recently that you can use it to set secrets to use them in GitHub Actions. SO much easier than setting them from the web interface.

gh secret set FLY_API_TOKEN

Also gh auth token is a great way to get a token to authenticate to the GitHub API, like this:

export GITHUB_TOKEN=$(gh auth token)
curl -H "Authorization: Bearer $GITHUB_TOKEN" \
        https://api.github.com/repos/gohugoio/hugo/releases/tags/v0.136.0 | jq -r '.body'