From bed488b94eaab12f5e3586ace3e9f2f35da390cf Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 20 May 2025 08:56:36 -0700 Subject: [PATCH] Auto license report --- .github/workflows/auto-license-report.yml | 56 +++++++++++++++++++ .../workflows/auto-update-pull-request.yml | 1 + 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/auto-license-report.yml diff --git a/.github/workflows/auto-license-report.yml b/.github/workflows/auto-license-report.yml new file mode 100644 index 000000000000..aa242b0e9a43 --- /dev/null +++ b/.github/workflows/auto-license-report.yml @@ -0,0 +1,56 @@ +name: Auto license report +on: + pull_request: + types: + - opened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Free disk space + run: .github/scripts/gha-free-disk-space.sh + + - name: Set up JDK for running Gradle + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + distribution: temurin + java-version-file: .java-version + + - name: Set up gradle + uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1 + with: + cache-read-only: true + + - name: Check out PR branch + env: + GH_TOKEN: ${{ github.token }} + run: gh pr checkout ${{ github.event.pull_request.number }} + + - name: Update license report + run: ./gradlew generateLicenseReport --no-build-cache + + - id: create-patch + name: Create patch file + run: | + git diff > patch + if [ -s patch ]; then + echo "exists=true" >> "$GITHUB_OUTPUT" + fi + + - name: Upload patch file + if: steps.create-patch.outputs.exists == 'true' + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + path: patch + name: patch diff --git a/.github/workflows/auto-update-pull-request.yml b/.github/workflows/auto-update-pull-request.yml index 230d8fcd8352..fdef4cb8d9ee 100644 --- a/.github/workflows/auto-update-pull-request.yml +++ b/.github/workflows/auto-update-pull-request.yml @@ -3,6 +3,7 @@ on: workflow_run: workflows: - "Auto spotless" + - "Auto license report" types: - completed