Skip to content

Commit

Permalink
Create test-workflow.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaStakater authored Dec 15, 2023
1 parent af16a2c commit f7c8946
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/test-workflow.yaml
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

0 comments on commit f7c8946

Please sign in to comment.