Export failed wrapper(s) path to GITHUB_OUTPUT

This commit is contained in:
jorgectf 2023-07-18 14:41:49 +02:00 committed by Daz DeBoer
parent 01ad6d2663
commit 56b90f209b
3 changed files with 13 additions and 0 deletions

View file

@ -16,6 +16,10 @@ inputs:
required: false required: false
default: '' default: ''
outputs:
failed-wrapper:
description: The path of the Gradle Wrapper(s) JAR that failed validation.
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

3
dist/index.js vendored
View file

@ -212,6 +212,9 @@ async function run() {
} }
else { else {
core.setFailed(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/wrapper-validation-action#reporting-failures\n${result.toDisplayString()}`); core.setFailed(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/wrapper-validation-action#reporting-failures\n${result.toDisplayString()}`);
if (result.invalid.length > 0) {
core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`);
}
} }
} }
catch (error) { catch (error) {

View file

@ -17,6 +17,12 @@ export async function run(): Promise<void> {
core.setFailed( core.setFailed(
`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/wrapper-validation-action#reporting-failures\n${result.toDisplayString()}` `Gradle Wrapper Validation Failed!\n See https://github.com/gradle/wrapper-validation-action#reporting-failures\n${result.toDisplayString()}`
) )
if (result.invalid.length > 0) {
core.setOutput(
'failed-wrapper',
`${result.invalid.map(w => w.path).join('|')}`
)
}
} }
} catch (error) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {