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-02-18 13:07:08 +01:00
|
|
|
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
|
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
|
2025-02-22 23:55:09 +01:00
|
|
|
uses: actions/create-github-app-token@0d564482f06ca65fa9e77e2510873638c82206f2 # v1.11.5
|
2025-01-15 20:43:14 +01:00
|
|
|
with:
|
2025-01-15 20:50:06 +01:00
|
|
|
app-id: ${{ secrets.GH_APP_ID }}
|
2025-01-15 20:43:14 +01:00
|
|
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
2025-02-03 11:13:02 +01:00
|
|
|
|
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
|
2025-02-03 11:08:34 +01:00
|
|
|
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
|
2024-01-04 20:17:38 +01:00
|
|
|
with:
|
2024-04-21 17:30:17 +02:00
|
|
|
java-version: "17"
|
|
|
|
distribution: "adopt"
|
|
|
|
|
2025-02-04 11:42:29 +01:00
|
|
|
- uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
|
2024-01-04 20:17:38 +01:00
|
|
|
|
2025-02-03 11:13:02 +01:00
|
|
|
- name: check the licenses for compatibility
|
|
|
|
run: ./gradlew clean checkLicense
|
|
|
|
|
|
|
|
- name: FAILED - check the licenses for compatibility
|
|
|
|
if: failure()
|
2025-02-23 20:55:08 +01:00
|
|
|
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
2025-02-03 11:13:02 +01:00
|
|
|
with:
|
|
|
|
name: dependencies-without-allowed-license.json
|
|
|
|
path: |
|
|
|
|
build/reports/dependency-license/dependencies-without-allowed-license.json
|
|
|
|
retention-days: 3
|
2024-01-04 20:17:38 +01:00
|
|
|
|
|
|
|
- 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-02-25 22:29:06 +01:00
|
|
|
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # v7.0.7
|
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 }}
|