Skip to content

Add License Conformity Check #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/license-checker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "License Check Audit"

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
schedule:
- cron: "0 3 * * *"

jobs:
license-check-golang-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Golang | Install Golang
uses: actions/setup-go@v4
with:
Comment on lines +18 to +19
Copy link

@coderabbitai coderabbitai bot Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Would you consider upgrading the setup-go action to v5?

The latest version v5.1.0 is available, which could provide newer features and security improvements. Would you like to update from v4?

🔗 Analysis chain

Should we verify the latest setup-go action version?

Would you like to check if there's a newer version available than v4?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest setup-go action version
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/actions/setup-go/releases/latest | \
  jq -r '.tag_name'

Length of output: 113

🧰 Tools
🪛 actionlint (1.7.4)

18-18: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, but I'll make a new pr for this

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uvulpos, would you like me to open a GitHub issue to track this upgrade? 🐰🎉

go-version: 1.23.3

- name: Golang | Install License Checker
run: go install github.com/google/go-licenses@latest

- name: Golang | Run License Check
run: make license-check-be

license-check-npm-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: NPM | Install NodeJS
uses: actions/setup-node@v2
with:
node-version: 23.3.0
- name: Install Dependencies
run: (cd services/frontend ; npm install)

- name: NPM | Install License Checker
run: npm install -g license-checker

- name: NPM | Run License Check
run: make license-check-fe
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ALLOWED_LICENSES_COMMA ?= "MIT,BSD-3-Clause,Apache-2.0,MPL-2.0,ISC"
ALLOWED_LICENSES_SEMICOLON ?= "MIT;BSD-3-Clause;Apache-2.0;ISC;OFL-1.1;CC0-1.0;0BSD;UNLICENSED"
IGNORE ?= "github.com/uvulpos/golang-sveltekit-template,golang.org/x"

.install-deps: ## install all dependencies
@bash ./devops/scripts/utils/install-dependencies.sh
Expand Down Expand Up @@ -29,6 +32,16 @@ build-dockerfile-frontend: ## build the frontend microservice
build-dockerfile-backend: ## build the backend microservice
@bash ./devops/scripts/build-container/backend.sh

license-check-be: ## runs golang license check
@(cd services/backend ; go-licenses check ./... --allowed_licenses=$(ALLOWED_LICENSES_COMMA) --ignore=$(IGNORE) --one_output); \
STATUS=$$?; \
exit $$STATUS

license-check-fe: ## runs npm license check
@(cd services/frontend ; license-checker --onlyAllow=$(ALLOWED_LICENSES_SEMICOLON)); \
STATUS=$$?; \
exit $$STATUS

help: ## print our all commands to commandline
@echo "\033[34m"
@echo " SvelteKit + Golang Example"
Expand Down
Loading