Skip to content

Commit

Permalink
Merge pull request devspace-sh#2815 from devspace-sh/feat/oss_license…
Browse files Browse the repository at this point in the history
…_checker

feat(ci): add License checker bot
  • Loading branch information
lizardruss authored Mar 21, 2024
2 parents 0480275 + e89a0c2 commit 847ada8
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 52 deletions.
18 changes: 18 additions & 0 deletions .github/licenses.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Open Source Licenses
sidebar_label: OSS Licenses
---

# devspace dependencies

The following open source dependencies are used to build [devspace][].

[devspace]: https://www.devspace.sh

## Go Packages

Some packages may only be included on certain architectures or operating systems.

{{ range . }}
- [{{.Name}}](https://pkg.go.dev/{{.Name}}) ([{{.LicenseName}}]({{.LicenseURL}}))
{{- end }}
53 changes: 53 additions & 0 deletions .github/workflows/go-licenses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: go-licenses

on:
push:
branches:
- main
paths:
- .github/licenses.tmpl
- .github/workflows/go-licenses.yaml
- go.mod
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
update-licenses:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Install go-licenses
run: |
go install github.com/google/[email protected]
- name: Run go-licenses
run: go-licenses report ./... > docs/pages/licenses/devspace.mdx --template .github/licenses.tmpl --ignore github.com/loft-sh

- name: Check invalid licenses
run: |
if cat licenses/devspace.mdx | grep '^ - ' | grep -Evi "apache|bsd|mit|isc|python|postgre|x11|zlib"; then
echo "ERR: Found invalid licenses!"
exit 1
fi
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
committer: Loft Bot <[email protected]>
branch: licenses/devspace
commit-message: "license(devspace): Updated OSS licenses"
title: "license(devspace): Updated OSS licenses"
body: Triggered by ${{ github.repository }}@${{ github.sha }}
signoff: true
delete-branch: true
Loading

0 comments on commit 847ada8

Please sign in to comment.