Skip to content

Commit 06c9e09

Browse files
committed
Adding virustotal output to generated release notes in release workflow
1 parent 6faa3be commit 06c9e09

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

.github/workflows/release.yml

+39-4
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ jobs:
8888
uses: actions/download-artifact@v4
8989
- name: Build universal
9090
run: |
91+
if [ "$VER" = "master" ]; then
92+
VER=0.0.0-dev
93+
fi
94+
9195
export WORKDIR=$PWD/build/darwin/universal/$VER
9296
mkdir -p $WORKDIR
9397
@@ -182,10 +186,8 @@ jobs:
182186
request_rate: 4
183187
files: |
184188
./scan/*
185-
- name: Add VirusTotal Info
186-
run: |
187-
echo '${{ toJSON(steps.virustotal.outputs) }}'
188-
- name: Draft Release
189+
- name: Generate Release Notes
190+
id: generate_release_notes
189191
uses: softprops/action-gh-release@v2
190192
if: startsWith(github.ref, 'refs/tags/v')
191193
with:
@@ -195,3 +197,36 @@ jobs:
195197
files: |
196198
dist-*/*/*/*.tar.bz2
197199
dist-*/*/*/*.zip
200+
- name: Add VirusTotal Info to Release Notes
201+
if: startsWith(github.ref, 'refs/tags/v')
202+
run: |
203+
# get release notes
204+
url=https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ steps.generate_release_notes.outputs.id }}
205+
body=$(
206+
curl \
207+
-L \
208+
-H "Accept: application/vnd.github+json" \
209+
-H "Authorization: Bearer $GITHUB_TOKEN" \
210+
-H "X-GitHub-Api-Version: 2022-11-28" \
211+
$url \
212+
| jq -r .body
213+
)
214+
215+
# append virustotal details to release notes
216+
nl=$'\n'
217+
body+="$nl[VirusTotal](https://www.virustotal.com) analysis:$nl"
218+
while read -r -d, line; do
219+
name=$(sed -e 's/^\.\/scan\/\([^=]\+\)=.*/\1/' <<< "$line")
220+
vturl=$(sed -e 's/.*=\(https.*\)/\1/' <<< "$line")
221+
body+="* [$name]($vturl)$nl"
222+
done <<< "$a"
223+
224+
# update release notes
225+
curl \
226+
-L \
227+
-X PATCH \
228+
-H "Accept: application/vnd.github+json" \
229+
-H "Authorization: Bearer $GITHUB_TOKEN" \
230+
-H "X-GitHub-Api-Version: 2022-11-28" \
231+
-d "{\"body\": \"$body\"}" \
232+
$url

0 commit comments

Comments
 (0)