Regarding those asterisks ***
, according to Accessing your secrets:
Warning: GitHub automatically redacts secrets printed to the log ...
So, those secrets are automatically being redacted in logs.
After setting the secrets as environment variables using env
, you can use those directly with $Env:<variable>
syntax instead of using ${{ env.variable }}
:
- name: Connecting to shared drive
env:
username: ${{ secrets.TEST_USERNAME }}
password: ${{ secrets.TEST_PASSWORD }}
run: |
"$Env:GITHUB_WORKSPACE\Connect-Drive.ps1" "$Env:username" "$Env:password"
Need double quotes around $Env:<variable>
to be expandable.
See the Default environment variables for GITHUB_WORKSPACE
.
If you do use the env
context, make sure to use quotes. In this case, prefer single quotes as the values may contain literals expandable by the shell. See the Quoting Rules for Powershell 7.2 for more details as GHA-hosted Windows runners have Powershell 7.2.10 preinstalled.