-
Notifications
You must be signed in to change notification settings - Fork 39
72 lines (57 loc) · 2 KB
/
audit-frontend.yaml
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
# GitHub action script to audit for unused frontend packages.
name: Audit Frontend
on:
workflow_dispatch:
workflow_run:
workflows: ["CORE WEB - Build & Deploy To DEV", "MINESPACE - Build & Deploy To DEV"]
types: [requested]
branches:
- 'feature/**'
- 'MDS**'
- 'mds**'
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
paths:
- ./services/core-web/**
- ./services/minespace-web/**
jobs:
audit-frontend: # Audit for unused, vulnerable, and missing frontend packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install depcheck
run: |
npm install -g "[email protected]"
- name: Log dependencies in comment
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const execSync = require('child_process').execSync;
const minespace_output = execSync('depcheck ./services/minespace-web || true', { encoding: 'utf-8' });
const core_web_output = execSync('depcheck ./services/core-web || true', { encoding: 'utf-8' });
console.log('Minespace:\n', minespace_output);
console.log('Core-Web:\n', core_web_output);
const final_output = `#### Depcheck Results
<details><summary>Minespace Dependencies</summary>
\`\`\`\n
${minespace_output}
\`\`\`
</details>
<details><summary>Core-Web Dependencies</summary>
\`\`\`\n
${core_web_output}
\`\`\`
</details>`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: final_output
})