-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (67 loc) · 2.18 KB
/
validate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Validate
on:
pull_request:
jobs:
validate:
name: Validate code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install
run: |
npm ci
- name: Build
run: |
npm run build
- name: Changed files
id: changed-files
uses: tj-actions/changed-files@v45
- name: Validate changed files
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${CHANGED_FILES}; do
node ./build/validate.js $file
done
echo 'Downloads:'
ls ./downloads/
- name: VirusTotal Scan
id: virustotal
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
request_rate: 4
files: ./downloads/*
- name: VirusTotal Report
uses: actions/github-script@v7
with:
script: |
const analysis = '${{steps.virustotal.outputs.analysis}}';
if (!analysis) return;
let output = 'VirusTotal Report:\n';
let lines = analysis.split(',');
for (let line of lines) {
output += '- [' + line.replace('./downloads/', '').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: output
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
body: output
});
}