How to Use Secrets in GitHub Actions Workflows

In this blog post, we will see how to use secrets in GitHub Actions workflows and protect sensitive information.


To create a secret in GitHub actions, please refer to this blog post where we created a secret. In GitHub, we have two types of secrets, the first is a repo level secret, and the second is organisation level.

Once a secret has been created we access it using the following code.

${{ secrets.secret_name }}


The following example shows how I use a secret to login into Microsoft Azure.

on: [push]

name: Azure Login

    runs-on: ubuntu-latest
      - name: Log in to Azure
        uses: azure/login@v1
          creds: '${{ secrets.AZURE_CREDENTIALS }}'
          enable-AzPSSession: true

Leave a comment

Your email address will not be published.