Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow to fetch spdx licenses
Browse files Browse the repository at this point in the history
add specific files changed by the action
elrayle committed Jun 4, 2024
1 parent 59c8c6d commit bead043
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/fetch-licenses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Fetch Licenses

on:
workflow_dispatch:
inputs:
force_run:
description: 'Force run license extraction'
required: false
default: 'false'
schedule:
- cron: '0 0 * * *' # Runs at midnight ET

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
if: ${{ github.event.inputs.force_run != 'true' }}
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 "action@github.com"
git config --local user.name "GitHub Action"
git add cmd/licenses.json cmd/exceptions.json spdxexp/spdxlicenses/*.go
git commit -m "Add updated license files - $(date)"
git push
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "Update SPDX license files - $(date)"
body: "The files in this PR are auto-generated by the [fetch-licenses](./.git/workflows/fetch-license.yaml) workflow. It updates SPDX licenses based on the latest released set in the [spdx/license-list-data](https://github.com/spdx/license-list-data) repository maintained by [SPDX](https://spdx.org/licenses/)."
branch: "auto-update-licenses"
base: "main"

0 comments on commit bead043

Please sign in to comment.