Skip to content

Commit 736cb79

Browse files
feat(release_create): allow updated releases to add more VT results (#18)
1 parent 63b4aae commit 736cb79

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

actions/release_create/action.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,34 @@ runs:
8080
shell: bash
8181
run: |
8282
# Create body file with original content
83-
cat > release_body.md << 'BODY_EOF'
83+
rb_file=release_body.md
84+
cat > ${rb_file} << 'BODY_EOF'
8485
${{ inputs.body }}
8586
BODY_EOF
8687
88+
VT_HEADER="🛡️ **VirusTotal Results:**"
89+
8790
# If we have VT results, append them
8891
if [ -n '${{ steps.vt.outputs.json }}' ]; then
8992
# Add separator if body exists and isn't empty
90-
if [ -s release_body.md ] && [ "$(cat release_body.md | tr -d '[:space:]')" != "" ]; then
91-
echo "" >> release_body.md
93+
if [ -s ${rb_file} ] && [ "$(cat ${rb_file} | tr -d '[:space:]')" != "" ]; then
94+
echo "" >> ${rb_file}
95+
fi
96+
97+
# Check if VirusTotal Results header already exists, if not add it
98+
if ! grep -qF "$VT_HEADER" ${rb_file}; then
99+
echo "---" >> ${rb_file}
100+
echo "$VT_HEADER" >> ${rb_file}
92101
fi
93102
94103
# Append VirusTotal results
95-
echo "---" >> release_body.md
96-
echo "🛡️ **VirusTotal Results:**" >> release_body.md
97-
printf '%s\n' '${{ steps.vt.outputs.json }}' | jq -r '.[] | "- [\(.name)](\(.link))"' >> release_body.md
104+
printf '%s\n' '${{ steps.vt.outputs.json }}' | jq -r '.[] | "- [\(.name)](\(.link))"' >> ${rb_file}
98105
fi
99106
100107
# Set output
101108
{
102109
echo "body<<EOF"
103-
cat release_body.md
110+
cat ${rb_file}
104111
echo "EOF"
105112
} >> $GITHUB_OUTPUT
106113

0 commit comments

Comments
 (0)