|
| 1 | +# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Verify Licenses |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: [main] |
| 20 | + paths: |
| 21 | + - 'go.mod' |
| 22 | + - 'go.sum' |
| 23 | + pull_request: |
| 24 | + branches: [main] |
| 25 | + paths: |
| 26 | + - 'go.mod' |
| 27 | + - 'go.sum' |
| 28 | + workflow_dispatch: {} |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 35 | + cancel-in-progress: true |
| 36 | + |
| 37 | +jobs: |
| 38 | + verify-licenses: |
| 39 | + name: Verify CNCF-Approved Licenses |
| 40 | + runs-on: ubuntu-latest |
| 41 | + timeout-minutes: 10 |
| 42 | + steps: |
| 43 | + - name: Checkout Code |
| 44 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 45 | + |
| 46 | + - name: Setup Go |
| 47 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 48 | + with: |
| 49 | + go-version-file: go.mod |
| 50 | + cache: true |
| 51 | + |
| 52 | + - name: Install go-licenses |
| 53 | + run: go install github.com/google/go-licenses@latest |
| 54 | + |
| 55 | + - name: Report licenses |
| 56 | + run: | |
| 57 | + echo "=== Dependency Licenses ===" |
| 58 | + go-licenses report ./... 2>/dev/null | sort -t',' -k3 | column -t -s',' |
| 59 | + echo "" |
| 60 | + echo "=== License Summary ===" |
| 61 | + go-licenses report ./... 2>/dev/null | cut -d',' -f3 | sort | uniq -c | sort -rn |
| 62 | +
|
| 63 | + - name: Check licenses |
| 64 | + run: | |
| 65 | + # Allowed licenses (all CNCF-approved) |
| 66 | + go-licenses check ./... \ |
| 67 | + --allowed_licenses=Apache-2.0,BSD-2-Clause,BSD-3-Clause,ISC,MIT |
0 commit comments