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.
More on Contexts, Expressions, Env & Outputs
List the available contexts and what each holds.BeginnerWhich contexts can you use in which keys? Give two examples that trip people up.AdvancedWhat are the expression operators and how do comparisons coerce types?IntermediateHow do you write a ternary in GitHub Actions expressions?IntermediateWhat do `contains`, `startsWith`, `endsWith`, `format` and `join` do?BeginnerWhat are object filters (`.*`) and how are they useful?Intermediate