From 04a1aebece824b56e6ad6a401d015479cd1c50b3 Mon Sep 17 00:00:00 2001 From: fk <17876666+fkirc@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:34:03 +0200 Subject: [PATCH] feat: add option to skip summary (#345) --- .github/workflows/test.yml | 1 + action.yml | 4 ++++ dist/index.js | 5 ++++- src/main.ts | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b53b65d..176753a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,7 @@ jobs: concurrent_skipping: 'never' skip_after_successful_duplicate: 'true' paths_ignore: '["**/README.md", "**/docs/**"]' + skip_summary: 'true' main_job: needs: pre_job diff --git a/action.yml b/action.yml index 2adc895..fe0cbfe 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,10 @@ inputs: description: 'One of never, same_content, same_content_newer, outdated_runs, always' required: true default: 'never' + skip_summary: + description: 'If true, make the workflow logs shorter' + required: false + default: 'false' outputs: should_skip: description: 'Returns true if the current run should be skipped according to your configured rules' diff --git a/dist/index.js b/dist/index.js index b972596..45838f4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -437,7 +437,10 @@ function exitSuccess(args) { summary.push('', 'Changed Files', `${changedFiles}`, ''); } summary.push(''); - yield core.summary.addRaw(summary.join('')).write(); + const skipSummary = core.getBooleanInput("skip_summary"); + if (!skipSummary) { + yield core.summary.addRaw(summary.join('')).write(); + } core.setOutput('should_skip', args.shouldSkip); core.setOutput('reason', args.reason); core.setOutput('skipped_by', args.skippedBy || {}); diff --git a/src/main.ts b/src/main.ts index 1d4509b..0f7bb6b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -611,7 +611,10 @@ async function exitSuccess(args: { ) } summary.push('') - await core.summary.addRaw(summary.join('')).write() + const skipSummary = core.getBooleanInput("skip_summary") + if (!skipSummary) { + await core.summary.addRaw(summary.join('')).write() + } core.setOutput('should_skip', args.shouldSkip) core.setOutput('reason', args.reason)