Skip to content

Commit

Permalink
Commit the License Finder report as docs/package-licenses.html
Browse files Browse the repository at this point in the history
  • Loading branch information
masutaka committed Oct 21, 2024
1 parent ef2969c commit 6962983
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
license_finder:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
env:
HTML_REPORT: docs/package-licenses.html
steps:
- uses: actions/checkout@v4
# To make the success of this job a prerequisite for merging into the main branch,
Expand Down Expand Up @@ -40,3 +45,19 @@ jobs:
- name: Run License Finder
if: steps.changes.outputs.target == 'true'
run: license_finder

# Commit the License Finder report as docs/package-licenses.html
- name: Generate HTML report
if: steps.changes.outputs.target == 'true' && github.ref_name != github.event.repository.default_branch
run: license_finder report --format=html | tail -n +2 > "$HTML_REPORT"
- name: Commit HTML 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_ACTOR"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add "$HTML_REPORT"
git commit -m "Update $HTML_REPORT"
git push origin HEAD:${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6962983

Please sign in to comment.