From 631021bf98316c7b544edd3a462b56f7539303d6 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Tue, 23 May 2023 14:56:51 -0600 Subject: [PATCH] Document the `generate-job-summary` options Fixes #646 --- README.md | 72 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8095968..42ecdde 100644 --- a/README.md +++ b/README.md @@ -321,37 +321,28 @@ Gradle Home cache cleanup is disabled by default. You can enable this feature f gradle-home-cache-cleanup: true ``` -## Saving build outputs +## Build reporting -By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build, -but any output files generated by the build will not be saved. - -To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action. -For example: +The `gradle-build-action` collects information about any Gradle executions that occur in a workflow, and reports these via +a Job Summary, visible in the GitHub Actions UI. For each Gradle execution, details about the invocation are listed, together with +a link to any Build ScanĀ® published. +Generation of a Job Summary is enabled by default. If this is not desired, it can be disable as follows: ```yaml -jobs: - gradle: - runs-on: ubuntu-latest - steps: - - name: Checkout project sources - uses: actions/checkout@v3 - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - - name: Run build with Gradle wrapper - run: ./gradlew build --scan - - name: Upload build reports - uses: actions/upload-artifact@v3 - with: - name: build-reports - path: build/reports/ +generate-job-summary: false ``` -## Build scans +Note that the action collects information about Gradle invocations via an [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script) +located at `USER_HOME/.gradle/init.d/build-result-capture.init.gradle`. +If you are using init scripts for the [Gradle Enterprise Gradle Plugin](https://plugins.gradle.org/plugin/com.gradle.enterprise) like +[`scans-init.gradle` or `gradle-enterprise-init.gradle`](https://docs.gradle.com/enterprise/gradle-plugin/#scans_gradle_com), +you'll need to ensure these files are applied prior to `build-result-capture.init.gradle`. +Since Gradle applies init scripts in alphabetical order, one way to ensure this is via file naming. -If your build publishes a [build scan](https://gradle.com/build-scans/) the `gradle-build-action` action will: -- Add a notice with the link to the GitHub Actions user interface -- For each step that executes Gradle, adds the link to the published build scan as a Step output named `build-scan-url`. +### Build scan link as Step output + +As well as reporting the [Build Scan](https://gradle.com/build-scans/) link in the Job Summary, +the `gradle-build-action` action makes this link available as a Step output named `build-scan-url`. You can then use that link in subsequent actions of your workflow. For example: @@ -384,12 +375,31 @@ jobs: }) ``` -Note that the build scan capturing utilizes the [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script) -in the `USER_HOME/.gradle/init.d/` directory, with the file named `build-result-capture.init.gradle`. -So, if you are using the init scripts for the [Gradle Enterprise Gradle Plugin](https://plugins.gradle.org/plugin/com.gradle.enterprise) like -[`scans-init.gradle` or `gradle-enterprise-init.gradle`](https://docs.gradle.com/enterprise/gradle-plugin/#scans_gradle_com), -make sure that its file names have earlier alphabetical order to the `build-result-capture.init.gradle`, -since configuring capture requires Gradle Enterprise Gradle Plugin to be applied already. +### Saving build outputs + +By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build, +but any output files generated by the build will not be saved. + +To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action. +For example: + +```yaml +jobs: + gradle: + runs-on: ubuntu-latest + steps: + - name: Checkout project sources + uses: actions/checkout@v3 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Run build with Gradle wrapper + run: ./gradlew build --scan + - name: Upload build reports + uses: actions/upload-artifact@v3 + with: + name: build-reports + path: build/reports/ +``` ## Support for GitHub Enterprise Server (GHES)