mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-26 02:52:09 +00:00
Allow Job Summary generation to be disabled
This commit is contained in:
parent
306a7e4bb2
commit
63bcd47c1b
2 changed files with 13 additions and 4 deletions
|
@ -19,8 +19,6 @@ inputs:
|
||||||
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
||||||
required: false
|
required: false
|
||||||
default: ${{ github.ref_name != github.event.repository.default_branch }}
|
default: ${{ github.ref_name != github.event.repository.default_branch }}
|
||||||
# e.g. Use the following setting to only write cache entries from your 'main' branch
|
|
||||||
# cache-read-only: ${{ github.ref_name != 'main' }}
|
|
||||||
|
|
||||||
cache-write-only:
|
cache-write-only:
|
||||||
description: |
|
description: |
|
||||||
|
@ -55,6 +53,11 @@ inputs:
|
||||||
description: Path to the Gradle executable
|
description: Path to the Gradle executable
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
generate-job-summary:
|
||||||
|
description: When 'false', no Job Summary will be generated for the Job.
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
|
||||||
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
||||||
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
||||||
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
||||||
|
|
|
@ -11,6 +11,11 @@ import {BuildResult, loadBuildResults, writeJobSummary} from './job-summary'
|
||||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
||||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
||||||
const CACHE_LISTENER = 'CACHE_LISTENER'
|
const CACHE_LISTENER = 'CACHE_LISTENER'
|
||||||
|
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'
|
||||||
|
|
||||||
|
function generateJobSummary(): boolean {
|
||||||
|
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER)
|
||||||
|
}
|
||||||
|
|
||||||
export async function setup(buildRootDirectory: string): Promise<void> {
|
export async function setup(buildRootDirectory: string): Promise<void> {
|
||||||
const gradleUserHome = await determineGradleUserHome(buildRootDirectory)
|
const gradleUserHome = await determineGradleUserHome(buildRootDirectory)
|
||||||
|
@ -35,7 +40,6 @@ export async function setup(buildRootDirectory: string): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function complete(): Promise<void> {
|
export async function complete(): Promise<void> {
|
||||||
core.info('Inside setupGradle.complete()')
|
|
||||||
if (!core.getState(GRADLE_SETUP_VAR)) {
|
if (!core.getState(GRADLE_SETUP_VAR)) {
|
||||||
core.info('Gradle setup post-action only performed for first gradle-build-action step in workflow.')
|
core.info('Gradle setup post-action only performed for first gradle-build-action step in workflow.')
|
||||||
return
|
return
|
||||||
|
@ -52,7 +56,9 @@ export async function complete(): Promise<void> {
|
||||||
const gradleUserHome = core.getState(GRADLE_USER_HOME)
|
const gradleUserHome = core.getState(GRADLE_USER_HOME)
|
||||||
await caches.save(gradleUserHome, cacheListener)
|
await caches.save(gradleUserHome, cacheListener)
|
||||||
|
|
||||||
|
if (generateJobSummary()) {
|
||||||
writeJobSummary(buildResults, cacheListener)
|
writeJobSummary(buildResults, cacheListener)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function determineGradleUserHome(rootDir: string): Promise<string> {
|
async function determineGradleUserHome(rootDir: string): Promise<string> {
|
||||||
|
|
Loading…
Reference in a new issue