From 56b90f209b02bf6d1deae490e9ef18b21a389cd4 Mon Sep 17 00:00:00 2001 From: jorgectf Date: Tue, 18 Jul 2023 14:41:49 +0200 Subject: [PATCH] Export failed wrapper(s) path to `GITHUB_OUTPUT` --- action.yml | 4 ++++ dist/index.js | 3 +++ src/main.ts | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/action.yml b/action.yml index 7acfbc1..248f300 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,10 @@ inputs: required: false default: '' +outputs: + failed-wrapper: + description: The path of the Gradle Wrapper(s) JAR that failed validation. + runs: using: 'node16' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 22cf0e9..b96c440 100644 --- a/dist/index.js +++ b/dist/index.js @@ -212,6 +212,9 @@ async function run() { } else { 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) { diff --git a/src/main.ts b/src/main.ts index 4e50f5b..98096e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,12 @@ export async function run(): Promise { 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) { if (error instanceof Error) {