github-actions

How Can I Access the GitHub Actions Repository Secrets in my YML Workflow Script


I am working on a auto-deployment workflow using GitHub actions for a flask app.

In my GitHub Actions settings, I have created a Repository Secret named "SERVER_IP" -- See Attached Screenshot

Screenshot of GitHub Actions Secret Page Showing a Variable Named SERVER_IP

In My GitHub Workflow, I attempt the access this secret using the secret variable.

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - run: echo ${{ secrets.SERVER_IP }}

Yet, in my GitHub Action console, this echo statement prints this: echo *** Which seems to be a null value of some kind.

How can I access my Repository Secrets in my YML Workflow?


Solution

  • As pointed out by @phil in a comment on my original question, this question is answered in the GitHub Actions Docs:

    Link to the docs

    GitHub Actions automatically redacts the contents of all GitHub secrets that are printed to workflow logs.

    The code in my question is successfully accessing the Repository secrets, but they are being redacted by GitHub in the logs.