-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (74 loc) · 2.3 KB
/
check-vulns.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
76
77
78
79
name: Reusable flow to check for vulns in dependencies of a Node.js branch
on:
workflow_call:
inputs:
nodejsStream:
type: string
default: 'main'
secrets:
NVD_API_KEY:
required: true
workflow_dispatch:
inputs:
nodejsStream:
type: string
default: 'main'
permissions:
contents: read
issues: write
jobs:
check-vulns:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
steps:
- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Checkout current repository
uses: actions/checkout@v4
- name: Installing pre-reqs
working-directory: ./dep_checker
run: pip install -r requirements.txt
- name: Checkout node.js repo
uses: actions/checkout@v4
with:
repository: nodejs/node
path: node
ref: ${{ inputs.nodejsStream }}
- name: Run the check
working-directory: ./dep_checker
run: |
(
set -o pipefail
python main.py --json-output --gh-token ${{ secrets.GITHUB_TOKEN }} --nvd-key=${{ secrets.NVD_API_KEY }} ../node ${{ inputs.nodejsStream }} 2>&1 | tee result.log
)
- name: build matrix
id: set_matrix
if: ${{ failure() }}
working-directory: ./dep_checker
run: |
matrix=$(cat result.log | jq -c .)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
create-issues:
needs: check-vulns
if: ${{ always() }}
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.check-vulns.outputs.matrix) }}
max-parallel: 1
steps:
- uses: actions/checkout@v4
- uses: dblock/create-a-github-issue@v3
with:
update_existing: false
search_existing: open
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VULN_ID: ${{ matrix.vulnerabilities.id }}
VULN_URL: ${{ matrix.vulnerabilities.url }}
VULN_DEP_NAME: ${{ matrix.vulnerabilities.dependency }}
VULN_DEP_VERSION: ${{ matrix.vulnerabilities.version }}
NODEJS_STREAM: ${{ inputs.nodejsStream }}
ACTION_URL: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"