Skip to content

Generate licenses.json via GitHub Actions after dependency updates (#38) #43

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
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
6 changes: 5 additions & 1 deletion .github/workflows/general-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: General CI Workflow

on:
push:
branches:
- "**"

pull_request:
branches:
- master
- "**"

jobs:
test-and-build:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/update-licenses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update Licenses on Dependency Changes

on:
pull_request:
branches:
- "**"
paths:
- "package.json"
- "pnpm-lock.yaml"
types:
- opened
- synchronize
- reopened

permissions:
contents: write
pull-requests: write
actions: write

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

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || 'master' }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Generate licenses.json
run: |
pnpm add -g license-checker
license-checker --json > licenses.json

- name: Display licenses.json content
run: cat licenses.json

- name: Commit and push updated licenses
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add licenses.json
if ! git diff --cached --quiet; then
git commit -m "chore: Update licenses.json"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes to commit."
fi
100 changes: 100 additions & 0 deletions licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"@swc-node/[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/swc-project/swc-node",
"publisher": "LongYinan",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc-node/jest",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc-node/jest/LICENSE"
},
"@swc-node/[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/swc-project/swc-node",
"publisher": "LongYinan",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc-node/register",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc-node/register/LICENSE"
},
"@swc/[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/swc-project/pkgs",
"publisher": "강동윤",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc/cli",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc/cli/LICENSE"
},
"@swc/[email protected]": {
"licenses": "Apache-2.0",
"repository": "https://github.com/swc-project/swc",
"publisher": "강동윤",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc/core"
},
"@swc/[email protected]": {
"licenses": "Apache-2.0",
"repository": "https://github.com/swc-project/swc",
"publisher": "강동윤",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc/helpers",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@swc/helpers/LICENSE"
},
"@types/[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@types/jest",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@types/jest/LICENSE"
},
"@types/[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@types/node",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/@types/node/LICENSE"
},
"[email protected]": {
"licenses": "MIT",
"publisher": "@mattfsourcecode",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/LICENSE"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/fastify/fastify",
"publisher": "Matteo Collina",
"email": "[email protected]",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/fastify",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/fastify/LICENSE"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/jestjs/jest",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/jest",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/jest/LICENSE"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/remy/nodemon",
"publisher": "Remy Sharp",
"url": "https://github.com/remy",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/nodemon",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/nodemon/LICENSE"
},
"[email protected]": {
"licenses": "ISC",
"repository": "https://github.com/isaacs/rimraf",
"publisher": "Isaac Z. Schlueter",
"email": "[email protected]",
"url": "http://blog.izs.me/",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/rimraf",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/rimraf/LICENSE"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/TypeStrong/ts-node",
"publisher": "Blake Embrey",
"email": "[email protected]",
"url": "http://blakeembrey.me",
"path": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/ts-node",
"licenseFile": "/home/runner/work/fastify-swc-typescript-server/fastify-swc-typescript-server/node_modules/ts-node/LICENSE"
}
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@swc/core": "^1.10.12",
"@swc/helpers": "^0.5.15",
"@types/jest": "^29.5.14",
"@types/node": "^22.12.0",
"@types/node": "^22.13.0",
"jest": "^29.7.0",
"nodemon": "^3.1.9",
"rimraf": "^6.0.1",
Expand Down
Loading