Managing Secrets Within Github Actions

Pavol Kutaj
2 min readFeb 17, 2021

--

  • The aim of this tutorialšŸ” is a successful setup of secrets to authenticate a request to Zendesk Help Center API

1. Secret creation

  • Open repo
  • Go to Settings → Secrets → Add a new secret
  • Enter secret name
  • Enter secret value
  • Select Add secret
  • Open workflow file .\github\workflows\mail.yaml
  • Add to the step (you can also add this to different levels of the workflow)
  • the whole workflow that checks out my private repo, runs a publish script located in that repo, and then checks in changes done by that script look as follows

2. what are secrets

  • encrypted environment variables to be used in workflows

3. how do you make a secret available to an action?

  • either set as input in a workflow file (not covered here)
  • or set as an environment variable in a workflow file

4. github token

  • a secret automatically generated
  • can be used in a workflow
  • this is an access token that you can use to authenticate on behalf of the GitHub App installed on your repo responsible for running actions
  • constraint: only your repo
  • same as with other secrets, you need to refer it within the workflow file to make authenticated GitHub API calls with
  • usecases: running automated github workflows for features within github (adding labels, creating issues, etc)

5. list used sources

--

--

Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com