8181 - name : Format VirusTotal Results
8282 env :
8383 INPUT_BODY : ${{ inputs.body }}
84+ INPUT_TAG : ${{ inputs.tag }}
8485 if : inputs.virustotal_api_key != ''
8586 id : format-vt
8687 shell : bash
@@ -91,23 +92,38 @@ runs:
9192 ${INPUT_BODY}
9293 BODY_EOF
9394
94- VT_HEADER="🛡️ **VirusTotal Results :**"
95+ ASSETS_HEADER="📦 **Assets :**"
9596
96- # If we have VT results, append them
97+ # If we have existing results, append them
9798 if [ -n '${{ steps.vt.outputs.json }}' ]; then
98- # Check if VirusTotal Results header already exists, if not add it
99- if ! grep -qF "$VT_HEADER " ${rb_file}; then
99+ # Check if Assets header already exists, if not add it
100+ if ! grep -qF "$ASSETS_HEADER " ${rb_file}; then
100101 # Add separator if body exists and isn't empty
101102 if [ -s ${rb_file} ] && [ "$(cat ${rb_file} | tr -d '[:space:]')" != "" ]; then
102103 echo "" >> ${rb_file}
103104 fi
104105
105- echo "---" >> ${rb_file}
106- echo "$VT_HEADER" >> ${rb_file}
106+ {
107+ echo "---"
108+ echo "$ASSETS_HEADER"
109+ echo ""
110+ echo "| ⬇️ Download | #️⃣ Download Count | 🛡️ VirusTotal |"
111+ echo "|-------------|-------------------|---------------|"
112+ } >> ${rb_file}
107113 fi
108114
109- # Append VirusTotal results
110- printf '%s\n' '${{ steps.vt.outputs.json }}' | jq -r '.[] | "- [\(.name)](\(.link))"' >> ${rb_file}
115+ # Append VirusTotal results as table rows
116+ printf '%s\n' '${{ steps.vt.outputs.json }}' | \
117+ jq -r \
118+ --arg repo "${{ github.repository }}" \
119+ --arg tag "${INPUT_TAG}" \
120+ '.[] |
121+ "| [\(.name)](https://github.com/\($repo)/releases/download/\($tag)/\(.name)) | " +
122+ "/\($tag)/\(.name)" +
123+ "?style=flat-square&label=&displayAssetName=false) | " +
124+ "[" +
125+ "?style=flat-square&icon=virustotal&label=)](\(.link)) |"' \
126+ >> ${rb_file}
111127 fi
112128
113129 # Set output
0 commit comments