-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (52 loc) · 1.88 KB
/
sbom.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
name: Generate SBOM
on:
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
sbom:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install snapd
run: sudo apt install snapd
- name: Install OSV-Scanner
run : sudo snap install osv-scanner
- name: Allow SBOM Plugin
run: composer config --no-plugins allow-plugins.cyclonedx/cyclonedx-php-composer true
- name: Install SBOM Plugin
run: composer require cyclonedx/cyclonedx-php-composer
- name: CREATE SBOM
run: composer CycloneDX:make-sbom --output-file=sbom.json --output-format=json
- name: Upload SBOM as an artifact
uses: actions/upload-artifact@v4
with:
name: sbom
path: sbom.json
- name: Run OSV-Scanner
id: osvscanner
run: osv-scanner --sbom=sbom.json --output=osv-results.txt
- name: Create fail comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ failure() && steps.osvscanner.conclusion == 'failure' }}
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'osv-results.txt'
- name: Create success comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ success() && steps.osvscanner.conclusion == 'success' }}
with:
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: 'No vulnerabilities found in the CycloneDX SBOM'
- name: Upload SBOM as an artifact
if: ${{ failure() && steps.osvscanner.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: osv
path: osv-results.txt