Skip to content

Commit fa59a90

Browse files
committed
Add license header check to CI workflow
1 parent 5bf18b9 commit fa59a90

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: License Header Check
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
license-check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
- name: Set up Go
13+
uses: actions/setup-go@v5
14+
go-version-file: "${{ github.workspace }}/go.mod"
15+
- name: Install addlicense
16+
run: go install github.com/google/addlicense@latest
17+
- name: Check license headers
18+
run: |
19+
$(go env GOPATH)/bin/addlicense \
20+
-check \
21+
-l apache \
22+
-c "MongoDB Inc" \
23+
-ignore "**/*.md,**/*.yaml,**/*.yml" .

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
uses: ./.github/workflows/test-unit.yml
5252
secrets: inherit
5353

54+
license-header-check:
55+
needs:
56+
- run-tests
57+
uses: ./.github/workflows/license-header-check.yml
58+
5459
check-licenses:
5560
needs:
5661
- run-tests

.github/workflows/tests-selectable.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branchName || github.head_ref }}
3131

3232
- name: Setup GO
33-
uses: actions/setup-go@v4
33+
uses: actions/setup-go@v5
3434
with:
35-
go-version: 1.23
35+
go-version-file: "${{ github.workspace }}/go.mod"
3636

3737
- name: Install Ginkgo
3838
run: go install github.com/onsi/ginkgo/v2/ginkgo@latest

0 commit comments

Comments
 (0)