diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 00000000..63c6a2f6 --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,53 @@ +name: License Compliance + +on: + push: + branches: + - main + pull_request: + +jobs: + license_finder: + runs-on: ubuntu-latest + timeout-minutes: 10 + 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 + + # Upload it once for reference only. If it seems unnecessary, you can stop uploading. + - name: Generate HTML report + if: steps.changes.outputs.target == 'true' + run: license_finder report --format=html > license-report.html + - name: Upload HTML artifact + if: steps.changes.outputs.target == 'true' + uses: actions/upload-artifact@v4 + with: + name: license-report + path: license-report.html