Secrets for Github Actions

Add secrets to a Github repository and access them for testing and CI/CD in Github Actions
Github
Author

Isaac Flath

Published

December 6, 2020

Today I Learned

I always assumed it was possible to pass secrets github actions, but I never really dove into it until now. So today I learned how to add secrets to github for use in the CI/CD for testing. I’m using it with nbdev

How to

  1. In your repository go to Settings -> Secrets -> Add New Secret and add your secret
  2. Add to your workflow.yml file
    env:
        key: ${{ secrets.your_secret_key }}
  1. Access in code as a normal environment variable
    import os
    your_secret_key = os.environ['your_secret_key']