Skip to content

Commit 394106f

Browse files
committed
Reformat virustotal section in release notes
1 parent ce5d30b commit 394106f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.github/workflows/virustotal.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ jobs:
6565
ANALYSIS_RESULT: ${{ steps.submit.outputs.analysis }}
6666
with:
6767
script: |
68+
const MARKER_START = '<!-- virustotal -->';
69+
const MARKER_END = '<!-- /virustotal -->';
6870
const tagName = process.env.TAG_NAME;
6971
const analysisResult = (process.env.ANALYSIS_RESULT || '').trim();
7072
if (analysisResult === '') {
@@ -82,11 +84,6 @@ jobs:
8284
core.setFailed('Release body is empty');
8385
return;
8486
}
85-
const SUMMARY = '<summary>VirusTotal analysis</summary>'
86-
if (originalBody.includes(SUMMARY)) {
87-
core.info('Release body already contains VirusTotal analysis, skipping update.');
88-
return;
89-
}
9087
let detailsLines = [];
9188
const analysisLines = analysisResult
9289
.split(',')
@@ -100,16 +97,20 @@ jobs:
10097
return;
10198
}
10299
const [_, filename, analysisURL] = match;
103-
detailsLines.push(` * [${filename}](${analysisURL})`);
100+
detailsLines.push(`* [${filename}](${analysisURL})`);
104101
});
105102
if (detailsLines.length === 0) {
106103
core.warning('No valid analysis lines found, skipping update.');
107104
return;
108105
}
109-
const newBody = originalBody + `\n\n<details>\n ${SUMMARY}\n\n${detailsLines.join('\n')}\n</details>\n`;
106+
const newBody = originalBody.replace(/[\r\n]+$/, '') + `\n\n${MARKER_START}\n## VirusTotal Analysis\n\n${detailsLines.join('\n')}\n\n${MARKER_END}\n`;
110107
core.startGroup('New release body');
111-
core.info(newBody);
108+
console.log(newBody);
112109
core.endGroup();
110+
if (originalBody.includes(MARKER_START) && originalBody.includes(MARKER_END)) {
111+
core.notice('Release body already contains VirusTotal analysis, skipping update.');
112+
return;
113+
}
113114
await github.rest.repos.updateRelease({
114115
owner,
115116
repo,

0 commit comments

Comments
 (0)