2024-01-04 20:17:38 +01:00
|
|
|
name: License Report Workflow
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
2024-04-21 17:30:17 +02:00
|
|
|
- "build.gradle"
|
2024-01-04 20:17:38 +01:00
|
|
|
|
2025-01-02 19:22:14 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2024-01-04 20:17:38 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
generate-license-report:
|
|
|
|
runs-on: ubuntu-latest
|
2024-12-22 00:33:41 +01:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
2024-01-04 20:17:38 +01:00
|
|
|
steps:
|
2024-12-21 13:28:35 +01:00
|
|
|
- name: Harden Runner
|
2025-01-13 23:26:05 +01:00
|
|
|
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
|
2024-12-21 13:28:35 +01:00
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
|
2025-01-15 20:43:14 +01:00
|
|
|
- name: Generate GitHub App Token
|
|
|
|
id: generate-token
|
|
|
|
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
|
|
|
|
with:
|
|
|
|
app-id: ${{ vars.GH_APP_ID }}
|
|
|
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
|
|
|
2024-01-04 20:17:38 +01:00
|
|
|
- name: Check out code
|
2024-12-21 13:28:35 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-01-04 20:17:38 +01:00
|
|
|
|
|
|
|
- name: Set up JDK 17
|
2024-12-21 13:28:35 +01:00
|
|
|
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
|
2024-01-04 20:17:38 +01:00
|
|
|
with:
|
2024-04-21 17:30:17 +02:00
|
|
|
java-version: "17"
|
|
|
|
distribution: "adopt"
|
|
|
|
|
2024-12-21 13:28:35 +01:00
|
|
|
- uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
|
2024-01-04 20:17:38 +01:00
|
|
|
|
|
|
|
- name: Run Gradle Command
|
|
|
|
run: ./gradlew clean generateLicenseReport
|
|
|
|
|
|
|
|
- name: Move and Rename License File
|
|
|
|
run: |
|
|
|
|
mv build/reports/dependency-license/index.json src/main/resources/static/3rdPartyLicenses.json
|
|
|
|
|
2024-03-13 23:26:39 +01:00
|
|
|
- name: Set up git config
|
2024-01-04 21:59:52 +01:00
|
|
|
run: |
|
2025-01-15 20:43:14 +01:00
|
|
|
git config --global user.name "stirlingbot[bot]"
|
|
|
|
git config --global user.email "1113334+stirlingbot[bot]@users.noreply.github.com"
|
2024-01-04 21:59:52 +01:00
|
|
|
|
2024-03-13 23:26:39 +01:00
|
|
|
- name: Run git add
|
2024-01-04 20:17:38 +01:00
|
|
|
run: |
|
2024-03-13 23:26:39 +01:00
|
|
|
git add src/main/resources/static/3rdPartyLicenses.json
|
2024-03-13 23:34:24 +01:00
|
|
|
git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
2024-03-13 23:26:39 +01:00
|
|
|
|
|
|
|
- name: Create Pull Request
|
2024-08-16 13:15:07 +02:00
|
|
|
id: cpr
|
2024-03-13 23:26:39 +01:00
|
|
|
if: env.CHANGES_DETECTED == 'true'
|
2025-01-02 15:24:04 +01:00
|
|
|
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
|
2024-03-13 23:26:39 +01:00
|
|
|
with:
|
2025-01-15 20:43:14 +01:00
|
|
|
token: ${{ steps.generate-token.outputs.token }}
|
2024-03-13 23:26:39 +01:00
|
|
|
commit-message: "Update 3rd Party Licenses"
|
2025-01-15 20:43:14 +01:00
|
|
|
committer: "stirlingbot[bot] <1113334+stirlingbot[bot]@users.noreply.github.com>"
|
|
|
|
author: "stirlingbot[bot] <1113334+stirlingbot[bot]@users.noreply.github.com>"
|
2024-03-13 23:26:39 +01:00
|
|
|
signoff: true
|
|
|
|
branch: update-3rd-party-licenses
|
|
|
|
title: "Update 3rd Party Licenses"
|
|
|
|
body: |
|
2025-01-15 20:43:14 +01:00
|
|
|
Auto-generated by StirlingBot
|
2024-12-22 01:41:45 +01:00
|
|
|
labels: licenses,github-actions
|
2024-03-13 23:26:39 +01:00
|
|
|
draft: false
|
|
|
|
delete-branch: true
|
2024-12-22 01:41:45 +01:00
|
|
|
sign-commits: true
|
2024-08-16 12:00:10 +02:00
|
|
|
|
2025-01-15 20:43:14 +01:00
|
|
|
- name: Enable Pull Request Automerge
|
2024-08-16 13:15:07 +02:00
|
|
|
if: steps.cpr.outputs.pull-request-operation == 'created'
|
2025-01-15 20:43:14 +01:00
|
|
|
run: gh pr merge --squash --auto "${{ steps.cpr.outputs.pull-request-number }}"
|
2024-08-16 13:15:07 +02:00
|
|
|
env:
|
2025-01-15 20:43:14 +01:00
|
|
|
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
|