diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7d79993..d273937 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -42,9 +42,33 @@ jobs: - name: VirusTotal Report uses: actions/github-script@v7 - env: - ANALYSIS: ${{steps.virustotal.outputs.analysis}} with: script: | - const { ANALYSIS } = process.env; - console.log(ANALYSIS); + const analysis = '${{steps.virustotal.outputs.analysis}}'; + if (!analysis) return; + let output = 'VirusTotal Report'; + let lines = analysis.split(','); + for (let line of lines) { + output += '- ' + file.replace('=https', ': https') + '\n'; + } + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + }); + const existingComment = comments.find(comment => comment.user.id === 41898282); + if (existingComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: commentBody + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.number, + body: commentBody + }); + }