Test masking inputs #9
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
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: loop | |
run: | | |
inps=$(jq -r '.inputs' $GITHUB_EVENT_PATH) | |
jq -c '.[]' $inps | while read i; do | |
echo $i | |
done | |
for i in $inps | |
do | |
echo "a" $i | |
done | |
- 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="${{ github.event.inputs.secret_token}}" | |
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::${{ github.event.inputs.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 | |
- name: Check Env | |
run: | | |
echo "${{ github.event.inputs.secret }}" |