Skip to content

Commit 847ada8

Browse files
authored
Merge pull request #2815 from devspace-sh/feat/oss_license_checker
feat(ci): add License checker bot
2 parents 0480275 + e89a0c2 commit 847ada8

5 files changed

Lines changed: 333 additions & 52 deletions

File tree

.github/licenses.tmpl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Open Source Licenses
3+
sidebar_label: OSS Licenses
4+
---
5+
6+
# devspace dependencies
7+
8+
The following open source dependencies are used to build [devspace][].
9+
10+
[devspace]: https://www.devspace.sh
11+
12+
## Go Packages
13+
14+
Some packages may only be included on certain architectures or operating systems.
15+
16+
{{ range . }}
17+
- [{{.Name}}](https://pkg.go.dev/{{.Name}}) ([{{.LicenseName}}]({{.LicenseURL}}))
18+
{{- end }}

.github/workflows/go-licenses.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: go-licenses
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/licenses.tmpl
9+
- .github/workflows/go-licenses.yaml
10+
- go.mod
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
update-licenses:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version-file: go.mod
29+
30+
- name: Install go-licenses
31+
run: |
32+
go install github.com/google/go-licenses@v1.6.0
33+
- name: Run go-licenses
34+
run: go-licenses report ./... > docs/pages/licenses/devspace.mdx --template .github/licenses.tmpl --ignore github.com/loft-sh
35+
36+
- name: Check invalid licenses
37+
run: |
38+
if cat licenses/devspace.mdx | grep '^ - ' | grep -Evi "apache|bsd|mit|isc|python|postgre|x11|zlib"; then
39+
echo "ERR: Found invalid licenses!"
40+
exit 1
41+
fi
42+
43+
- name: Create pull request
44+
uses: peter-evans/create-pull-request@v5
45+
with:
46+
token: ${{ secrets.GH_ACCESS_TOKEN }}
47+
committer: Loft Bot <loft-bot@users.noreply.github.com>
48+
branch: licenses/devspace
49+
commit-message: "license(devspace): Updated OSS licenses"
50+
title: "license(devspace): Updated OSS licenses"
51+
body: Triggered by ${{ github.repository }}@${{ github.sha }}
52+
signoff: true
53+
delete-branch: true

0 commit comments

Comments
 (0)