Skip to content

Commit d955e80

Browse files
Add workflow to run grype
1 parent 40a0e8b commit d955e80

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/grype.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow checks out code, builds an image, performs a container image
7+
# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub
8+
# Advanced Security code scanning feature. For more information on the Anchore scan
9+
# action usage and parameters, see https://github.com/anchore/scan-action. For more
10+
# information on Anchore's container image scanning tool Grype, see
11+
# https://github.com/anchore/grype
12+
name: vulnerability scan
13+
14+
on:
15+
push:
16+
branches: ["next", "main", "qa"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: '42 13 * * 3'
22+
23+
env:
24+
PKG_NAME: quicknxs
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
scan-package:
31+
permissions:
32+
contents: read # for actions/checkout to fetch code
33+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
34+
# only required for a private repository by github/codeql-action/upload-sarif
35+
# to get the Action run status
36+
actions: read
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Install conda package
40+
id: installer
41+
uses: ./pkg-install
42+
with:
43+
# local-channel: /tmp/local-channel
44+
package-name: ${{ env.PKG_NAME }}
45+
extra-channels: neutrons mantid
46+
47+
- name: Check out grype config
48+
uses: actions/checkout@v6
49+
with:
50+
sparse-checkout: |
51+
.grype.yaml
52+
sparse-checkout-cone-mode: false
53+
54+
- name: Run the Anchore Grype scan action
55+
uses: anchore/scan-action@v7
56+
id: scan
57+
with:
58+
path: ${{ steps.installer.outputs.conda_install_dir }}
59+
fail-build: false
60+
only-fixed: true # don't create notifications for things without fixes
61+
- name: Upload vulnerability report
62+
uses: github/codeql-action/upload-sarif@v4
63+
if: ${{ success() || failure() }} # if the previous step ran
64+
with:
65+
sarif_file: ${{ steps.scan.outputs.sarif }}
66+
- name: Inspect action SARIF report
67+
if: ${{ runner.debug == true }}
68+
run: cat ${{ steps.scan.outputs.sarif }}

0 commit comments

Comments
 (0)