Interview Prep/GitHub Actions/Contexts, Expressions, Env & Outputs

How do you mask a value in logs that is not a registered secret?

IntermediateConceptContexts, Expressions, Env & Outputs
Answer
TOKEN=$(vault read -field=token secret/ci)
echo "::add-mask::$TOKEN"
echo "TOKEN=$TOKEN" >> "$GITHUB_ENV"

From then on, that exact string is replaced by *** in logs. Masking is by exact match, so derived forms (base64, URL-encoded, a substring) are not masked; mask each form you print. Mask before the first time it could appear in output.

All GitHub Actions questions Roadmap: GitHub Actions

More on Contexts, Expressions, Env & Outputs