Skip to content

Commit

Permalink
Merge pull request #28 from dinisnunes1/fix/add-optional-summary-input
Browse files Browse the repository at this point in the history
[Fix] Add optional `generate-job-summary` input to input parameters
  • Loading branch information
amyu authored Mar 16, 2023
2 parents 434ba07 + 7b26ed1 commit 240dd60
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ steps:
# Installed when the version is specified
ndk-version: '23.1.7779620'

# default: true
# Whether to generate or not the job summary
generate-job-summary: false

- run: ./gradlew build --stacktrace
```
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
required: false
description: 'disabled cache'
default: 'false'
generate-job-summary:
required: false
description: 'display job summary'
default: 'true'
job-status:
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
default: ${{ job.status }}
Expand Down
12 changes: 9 additions & 3 deletions dist/cleanup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions src/cleanup-android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ async function run(): Promise<void> {
const buildToolsVersion = core.getInput(constants.INPUT_BUILD_TOOLS_VERSION)
const ndkVersion = core.getInput(constants.INPUT_NDK_VERSION)
const cmakeVersion = core.getInput(constants.INPUT_CMAKE_VERSION)
const cacheDisabled = core.getInput(constants.INPUT_CACHE_DISABLED)
const cacheDisabled = core.getBooleanInput(constants.INPUT_CACHE_DISABLED)
const generateJobSummary = core.getBooleanInput(
constants.INPUT_GENERATE_JOB_SUMMARY
)

core.info(`cache-disabled: ${cacheDisabled}`)
core.info(`generate-job-summary: ${generateJobSummary}`)

let savedCacheEntry
if (!cacheDisabled) {
Expand All @@ -26,13 +32,15 @@ async function run(): Promise<void> {
)
}

await renderSummary(
sdkVersion,
buildToolsVersion,
ndkVersion,
cmakeVersion,
savedCacheEntry
)
if (generateJobSummary) {
await renderSummary(
sdkVersion,
buildToolsVersion,
ndkVersion,
cmakeVersion,
savedCacheEntry
)
}
} catch (error) {
if (error instanceof Error) core.setFailed(error.message)
}
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const INPUT_NDK_VERSION = 'ndk-version'
export const INPUT_CMAKE_VERSION = 'cmake-version'
export const INPUT_CACHE_DISABLED = 'cache-disabled'

export const INPUT_GENERATE_JOB_SUMMARY = 'generate-job-summary'
export const INPUT_JOB_STATUS = 'job-status'

// https://developer.android.com/studio#command-tools
Expand Down

0 comments on commit 240dd60

Please sign in to comment.