-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af16a2c
commit f7c8946
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Test masking inputs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
secret: | ||
description: "secret value" | ||
required: true | ||
token: | ||
description: "token value" | ||
required: true | ||
secret_token: | ||
description: "secret_token value" | ||
required: true | ||
jobs: | ||
test_masking_inputs: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Test masking inputs | ||
id: add_mask | ||
run: | | ||
INP_SECRET=$(jq -r '.inputs.secret' $GITHUB_EVENT_PATH) | ||
INP_TOKEN=$(jq -r '.inputs.token' $GITHUB_EVENT_PATH) | ||
INP_SECRET_TOKEN=$(jq -r '.inputs.secret_token' $GITHUB_EVENT_PATH) | ||
echo Before mask | ||
echo $INP_SECRET | ||
echo $INP_TOKEN | ||
echo $INP_SECRET_TOKEN | ||
echo ::add-mask::$INP_SECRET | ||
echo ::add-mask::$INP_TOKEN | ||
echo ::add-mask::$INP_SECRET_TOKEN | ||
echo After mask | ||
echo $INP_SECRET | ||
echo $INP_TOKEN | ||
echo $INP_SECRET_TOKEN | ||
echo Setting output | ||
echo ::set-output name=secret::$INP_SECRET | ||
echo ::set-output name=token::$INP_TOKEN | ||
echo ::set-output name=secret_token::$INP_SECRET_TOKEN | ||
echo Setting environment variables | ||
echo SECRET="$INP_SECRET" >> $GITHUB_ENV | ||
echo TOKEN="$INP_TOKEN" >> $GITHUB_ENV | ||
echo SECRET_TOKEN="$INP_SECRET_TOKEN" >> $GITHUB_ENV | ||
- name: Check output from another step | ||
run: | | ||
echo "${{ steps.add_mask.outputs.secret }}" | ||
echo "${{ steps.add_mask.outputs.token }}" | ||
echo "${{ steps.add_mask.outputs.secret_token }}" | ||
- name: Check environment variables 1 | ||
run: | | ||
echo "${{ env.SECRET }}" | ||
echo "${{ env.TOKEN }}" | ||
echo "${{ env.SECRET_TOKEN }}" | ||
- name: Check environment variables 2 | ||
run: | | ||
echo $SECRET | ||
echo $TOKEN | ||
echo $SECRET_TOKEN |