Skip to content

Commit

Permalink
add workflow to fetch spdx licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
elrayle committed May 13, 2024
1 parent 502dc8e commit 0ea00e5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/fetch-licenses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Fetch Licenses

on:
workflow_dispatch: # Allows manual triggering of the workflow
schedule:
- cron: '0 0 * * *' # Runs at midnight ET
push:
branches:
- elr/update-licenses

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

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: auto-update-licenses

- name: Checkout SPDX Repository
uses: actions/checkout@v2
with:
repository: spdx/license-list-data
path: spdx-license-list-data

- name: Copy Licenses
run: |
cp spdx-license-list-data/json/licenses.json cmd/licenses.json
cp spdx-license-list-data/json/exceptions.json cmd/exceptions.json
- name: Check for changes
run: |
git diff --exit-code -- cmd/licenses.json cmd/exceptions.json || exit 0
- name: Run license extraction
run: |
cd cmd
go run . extract -l -e
cd ..
- name: Commit and push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add cmd/
git commit -m "Add updated license files - $(date)" -a
git push

0 comments on commit 0ea00e5

Please sign in to comment.