Skip to content

Commit 0ea00e5

Browse files
committed
add workflow to fetch spdx licenses
1 parent 502dc8e commit 0ea00e5

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/fetch-licenses.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Fetch Licenses
2+
3+
on:
4+
workflow_dispatch: # Allows manual triggering of the workflow
5+
schedule:
6+
- cron: '0 0 * * *' # Runs at midnight ET
7+
push:
8+
branches:
9+
- elr/update-licenses
10+
11+
jobs:
12+
fetch-licenses:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v2
18+
with:
19+
ref: auto-update-licenses
20+
21+
- name: Checkout SPDX Repository
22+
uses: actions/checkout@v2
23+
with:
24+
repository: spdx/license-list-data
25+
path: spdx-license-list-data
26+
27+
- name: Copy Licenses
28+
run: |
29+
cp spdx-license-list-data/json/licenses.json cmd/licenses.json
30+
cp spdx-license-list-data/json/exceptions.json cmd/exceptions.json
31+
32+
- name: Check for changes
33+
run: |
34+
git diff --exit-code -- cmd/licenses.json cmd/exceptions.json || exit 0
35+
36+
- name: Run license extraction
37+
run: |
38+
cd cmd
39+
go run . extract -l -e
40+
cd ..
41+
42+
- name: Commit and push
43+
run: |
44+
git config --local user.email "[email protected]"
45+
git config --local user.name "GitHub Action"
46+
git add cmd/
47+
git commit -m "Add updated license files - $(date)" -a
48+
git push

0 commit comments

Comments
 (0)