I'm trying to dive in the GitHub Action, and to understand the process I would like to echo some environment variables, such as ${{ github.repository }}
, ${{ github.repository_owner }}
or event secrets like ${{ secrets.GITHUB_TOKEN }}
, etc. But then in the output I'm getting ***
.
Is there any way to force the output to show the actual values instead of the asterisks?
dev.yml
name: Dev
on:
workflow_dispatch:
push:
branches:
- dev
env:
BUILD_TYPE: core
DEFAULT_PYTHON: 3.8
jobs:
any_name:
runs-on: ubuntu-latest
steps:
- name: Any Name Bash Test Step
shell: bash
run: |
echo "GH_REPO: $GH_REPO"
echo "GH_REPO_O: $GH_REPO_O"
echo "GH_T: $GH_T"
env:
GH_REPO: ${{ github.repository }}
GH_REPO_O: ${{ github.repository_owner }}
GH_T: ${{ secrets.GITHUB_TOKEN }}
output
Run echo "GH_REPO: $GH_REPO"
echo "GH_REPO_O: $GH_REPO_O"
echo "GH_T: $GH_T"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
BUILD_TYPE: core
DEFAULT_PYTHON: 3.8
GH_REPO: ***/core
GH_REPO_O: ***
GH_T: ***
GH_REPO: ***/core
GH_REPO_O: ***
GH_T: ***
You can't show secrets
through echo
otherwise there would be a huge security problem (even using env
variables as an intermediary).
However, this will work with the other variables you used, the problem in your case seems to be related to the syntax. You should use run: echo "$GITHUB_REPOSITORY"
and run: echo "$GITHUB_REPOSITORY_OWNER"
to see them directly on your workflow.
Note: ${{ github.repository }}
or ${{ github.repository_owner }}
also works.
Tip: You can identify most of the variables that can be shown with echo through the Github Context using run: echo "$GITHUB_CONTEXT"
in your workflow.
Example: