Skip to content

Migrate NOTICE.md to License report #59

Migrate NOTICE.md to License report

Migrate NOTICE.md to License report #59

Workflow file for this run

name: License Compliance
on:
push:
branches:
- main
pull_request:
jobs:
license_finder:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
env:
LICENSE_REPORT: docs/packages-license.md
steps:
- uses: actions/checkout@v4
# To make the success of this job a prerequisite for merging into the main branch,
# set a filter here instead of on: to determine whether or not to proceed to the next step.
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
target:
- .github/workflows/license.yml
- bun.lockb
- config/dependency_decisions.yml
- config/license_finder.yml
- package.json
- uses: oven-sh/setup-bun@v2
if: steps.changes.outputs.target == 'true'
with:
bun-version-file: "package.json"
- run: bun install
if: steps.changes.outputs.target == 'true'
- uses: ruby/setup-ruby@v1
if: steps.changes.outputs.target == 'true'
with:
ruby-version: '3.3'
- name: Install License Finder
if: steps.changes.outputs.target == 'true'
run: gem install -N license_finder
- name: Run License Finder
if: steps.changes.outputs.target == 'true'
run: license_finder
# Commit the License Finder report as docs/packages-license.md
- name: Generate license report
if: steps.changes.outputs.target == 'true' && github.ref_name != github.event.repository.default_branch
run: license_finder report --format=markdown | tail -n +2 > "$LICENSE_REPORT"
- name: Commit license report and push
if: steps.changes.outputs.target == 'true' && github.ref_name != github.event.repository.default_branch
run: |
git remote set-url origin "https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}"
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add "$LICENSE_REPORT"
git commit -m "Update $LICENSE_REPORT"
git push origin ${{ github.event.pull_request.head.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}