Skip to content

Instantly share code, notes, and snippets.

@philip-gai
philip-gai / gh-set-secret.yml
Last active January 14, 2024 18:11
GitHub Actions: Set a repo environment secret using the gh cli in 1-2 steps
# Prerequisites:
# - Create a secret with your PAT token. Permissions needed: repo (all) and read:org
# - Create the HELLO_WORLD secret in your environment with some dummy initial value
#
# Notes:
# - You can tell that it works because it masks the secret_body in the echo secret step after it creates the secret 😄
# - If you don't want to have to pass --repo to gh secret set, then put the actions/checkout@v2 step before the gh secret set step
name: gh-set-secret