Merge pull request #62 from github/elr/update-licenses

add workflow to fetch spdx licenses
This commit is contained in:
E. Lynette Rayle 2024-06-05 14:32:39 -04:00 коммит произвёл GitHub
Родитель ceeb5c0c4c 01287adcc9
Коммит f191b121c9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 59 добавлений и 0 удалений

58
.github/workflows/fetch-licenses.yaml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,58 @@
name: Fetch Licenses
on:
workflow_dispatch:
inputs:
force_run:
description: 'Force run license extraction'
required: false
default: 'false'
schedule:
- cron: '5 4 * * *' # Runs at 0405 UTC (0605 CET, 0005 ET, 2105 PT)
jobs:
fetch-licenses:
runs-on: ubuntu-latest
steps:
- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Checkout this repository's auto-update-licenses branch
uses: actions/checkout@v2
- name: Checkout official SPDX Repository
uses: actions/checkout@v2
with:
repository: spdx/license-list-data
path: official-spdx-licenses # creates a tmp dir to hold the SPDX licenses from the official repo
- name: Copy Licenses
run: |
cp official-spdx-licenses/json/licenses.json cmd/licenses.json
cp official-spdx-licenses/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
echo "Current branch: $(git branch)"
go run . extract -l -e
cd ..
git log --oneline -n 5
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Add updated license files
branch: auto-update-licenses
base: main
title: "Update SPDX license files"
body: "The files in this PR are auto-generated by the [fetch-licenses](./.git/workflows/fetch-license.yaml) workflow when it runs the `cmd/extract` script. 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/). \n\nTODO: [spdxexp/spdxlicenses/license_ranges.go](./spdxexp/spdxlicenses/license_range.go) has to be updated manually."
labels: 'auto-update,licenses'

Просмотреть файл

@ -53,6 +53,7 @@ func main() {
os.Exit(1)
}
fmt.Println("Done!")
fmt.Println("---------------------------")
}
default:
writeHelpMessage()