Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 5

Mask PowerShell statement

Solved! Go to Solution.

Hi, loving GitHub Actions!

 

Quick question: a step in my workflow job has a PowerShell statement that reads a long value from the deployment payload, and concatenates it to make a variable value. In the logs, the `payload.long_value` is printed, but I'd like to mask it.

 

shell: powershell
run: |
    $something_long = "something.." + "${{ github.event.deployment.payload.long_value }}"

I can't put it in an environment variable because the value is too long. Is there any way to mask a statement or payload property in PowerShell code?

4 Replies
Copilot Lvl 3
Message 2 of 5

Re: Mask PowerShell statement

I tried using the Stop and start log commands in our PowerShell inline-code as below:

 

shell: powershell
run: |
echo ::stop-commands::pause-logging
$something_long = "something.." + "${{ github.event.deployment.payload.long_value }}"
echo ::pause-logging::

But it still shows that statement with `payload.long_value` in the logs.

 

If there any way to hide/mask it in the logs?

Copilot Lvl 3
Message 3 of 5

Re: Mask PowerShell statement

This is crucial for us, in terms of data security, to consider Actions for production CI/CD. Please advise @ethomson @chrispat @mscoutermarsh 

Solution
GitHub Staff
Message 4 of 5

Re: Mask PowerShell statement

If the value is too long for an environment variable we are not going to be able to mask it.  My suggestion would be to read the value from the payload file on disk rather than using the context in this case.  You can find the path to the  payload file in the GITHUB_EVENT_PATH environment variable https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-vari....

Copilot Lvl 3
Message 5 of 5

Re: Mask PowerShell statement

Thank you! (Btw, variable name is GITHUB_EVENT_PATH)