动作:
- id: sets-a-secret
run: |
local_secret=$(doppler secrets get GAR_JSON_KEY --plain)
echo "::add-mask::$local_secret"
echo "::set-output name=my-secret::$local_secret"
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
local_secret
的值为:
{
"type": "service_account",
"project_id": "contrawork"
}
在GitHub中,只有值的第一行被隐藏在日志中:
##[debug]/usr/bin/bash -e /var/actions-runner/_runners/1/_work/_temp/10dcce73-cb22-43d9-853d-6c9674f6895e.sh
::add-mask::***
"type": "service_account",
"project_id": "contrawork"
}
::set-output name=my-secret::***
##[debug]steps['sets-a-secret']['outputs']['my-secret']='***'
"type": "service_account",
"project_id": "contrawork"
}
##[debug]Finishing: Run local_secret=$(doppler secrets get GAR_JSON_KEY --plain)
如何正确使用add-mask
以避免在输出中暴露多行值?