-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (54 loc) · 1.99 KB
/
scan-license.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
name: License scan
on:
workflow_dispatch:
inputs:
version:
description: 'Flux version'
required: false
push:
branches:
- 'main'
- 'license-*'
jobs:
trivy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Latest release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(gh release view --json tagName -q '.tagName')
if [ "${{ github.event.inputs.version }}" != "" ]; then
VERSION="${{ github.event.inputs.version }}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Checkout Flux
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: fluxcd/flux2
ref: ${{ steps.release.outputs.version }}
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
- name: Download Flux dependencies
run: |
make tidy
- name: Setup Trivy
run: |
sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy
- name: License report
run: |
trivy fs -q --format table --scanners license --severity UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL ./go.mod
- name: License check
run: |
trivy fs -q --format table --scanners license --severity UNKNOWN,HIGH,CRITICAL ./go.mod --exit-code 1