From 770a416742aded1ae81b3d9e3cd5e6d8838a5dcc Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Wed, 4 Nov 2026 09:42:25 +0100 Subject: [PATCH] go-license: Generic Go License Check Extract our Go License Check action used in Icinga DB, Notifications, K8s, and the Go Library into a reusable action. --- .github/workflows/go-license.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/go-license.yml diff --git a/.github/workflows/go-license.yml b/.github/workflows/go-license.yml new file mode 100644 index 0000000..5dadd58 --- /dev/null +++ b/.github/workflows/go-license.yml @@ -0,0 +1,39 @@ +on: + workflow_call: + inputs: + allowed_licenses: + type: string + required: true + description: 'Comma-separated list of allowed SPDX License Identifiers' + +permissions: + contents: read + +jobs: + go-license: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: '1' + persist-credentials: false + + - name: Setup Go + uses: actions/setup-go@v7 + with: + go-version: stable + + - name: Download modules to local cache + run: go mod download + + - name: Install go-licenses + run: go install github.com/google/go-licenses@latest + + - name: Check licenses against allow list + env: + ALLOWED_LICENSES: ${{ inputs.allowed_licenses }} + run: | + go-licenses check \ + "$(sed -n 's/^module \(.*\)$/\1/gp' go.mod)/..." \ + --allowed_licenses "$ALLOWED_LICENSES"