Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,23 @@ runs:
fi

keys=$(jq -r 'keys[]' "$out")
valfile="$(mktemp)"
trap 'shred -u "$out" "$valfile" 2>/dev/null || rm -f "$out" "$valfile"' EXIT
for k in $keys; do
v="$(jq -r --arg k "$k" '.[$k]' "$out")"
echo "::add-mask::$v"
jq -j --arg k "$k" '.[$k]' "$out" > "$valfile"
while IFS= read -r line || [[ -n "$line" ]]; do
[[ -n "$line" ]] && echo "::add-mask::$line"
done < "$valfile"
if [[ "$EXPORT_ENV" == "true" ]]; then
varname="${OUTPUT_PREFIX}${k}"
delim="ghadelim_$(openssl rand -hex 16)"
Comment thread
ferrfleet-interne[bot] marked this conversation as resolved.
Resolved
if grep -qF -- "$delim" "$valfile"; then
echo "::error::secret value contains the env delimiter, aborting" >&2
exit 1
fi
{
printf '%s<<FERRVAULT_EOF\n' "$varname"
printf '%s\n' "$v"
printf 'FERRVAULT_EOF\n'
printf '%s<<%s\n' "${OUTPUT_PREFIX}${k}" "$delim"
cat "$valfile"
printf '\n%s\n' "$delim"
} >> "$GITHUB_ENV"
fi
done
Expand Down
Loading