Skip to content

Commit

Permalink
feat: add GitHub Actions workflow for automatic LICENSES.md updates
Browse files Browse the repository at this point in the history
- Introduced a new workflow to automatically update the LICENSES.md file upon changes to go.mod and go.sum files on the main branch.
- The workflow installs go-licenses, generates a comprehensive LICENSES.md file listing licenses for the project and its dependencies, and creates a pull request with the updates.
- This enhancement improves documentation and compliance with licensing requirements for dependencies.
  • Loading branch information
tphakala committed Jan 14, 2025
1 parent 5ca277c commit c6e2806
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/update-licenses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Update Licenses

on:
push:
paths:
- 'go.mod'
- 'go.sum'
branches: [ main ]
workflow_dispatch:

jobs:
update-licenses:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Install go-licenses
run: go install github.com/google/go-licenses@latest

- name: Generate LICENSES.md
run: |
echo "# Licenses" > LICENSES.md
echo "" >> LICENSES.md
echo "## BirdNET-Go" >> LICENSES.md
echo "" >> LICENSES.md
echo "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International" >> LICENSES.md
echo "https://creativecommons.org/licenses/by-nc-sa/4.0/" >> LICENSES.md
echo "" >> LICENSES.md
echo "## Dependencies" >> LICENSES.md
echo "" >> LICENSES.md
go-licenses csv github.com/tphakala/birdnet-go | while IFS=, read -r package license source; do
echo "### $package" >> LICENSES.md
echo "" >> LICENSES.md
echo "License: $license" >> LICENSES.md
echo "Source: $source" >> LICENSES.md
echo "" >> LICENSES.md
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'docs: update dependency licenses'
title: 'Update dependency licenses'
body: |
Automatically updated LICENSES.md with current dependency licenses.
This PR was created automatically by the update-licenses workflow.
branch: update-licenses
delete-branch: true

0 comments on commit c6e2806

Please sign in to comment.