diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b57ac8..9239020 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,6 +50,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/README.md b/README.md index 4fae730..4e20965 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,10 @@ jobs: ### Example 3: Skip using `paths_filter` +> [!WARNING] +> If the paths_filter option is not working correctly, then you could copy the “example 1" multiple times according to your needs (see for details). + + The `paths_filter` option can be used if you have multiple jobs in a workflow and want to skip them based on different [`paths_ignore`](#paths_ignore) / [`paths`](#paths) patterns. When defining such filters, the action returns corresponding information in the [`paths_result`](#paths_result) output. For example in a monorepo, you might want to run jobs related to the "frontend" only if some files in the corresponding "frontend/" folder have changed and the same for "backend". This can be achieved with the following configuration: @@ -328,7 +332,7 @@ jobs: # If 'skip-duplicate-actions' terminates before the paths checks are performed (for example, when a successful duplicate run has # been found) 'paths_result' outputs an empty object ('{}'). This can be easily intercepted in the if condition of a job # by checking the result of the "global" 'should_skip' output first. - if: needs.pre_job.outputs.should_skip != 'true' || !fromJSON(needs.pre_job.outputs.paths_result).frontend.should_skip + if: needs.pre_job.outputs.should_skip != 'true' && !fromJSON(needs.pre_job.outputs.paths_result).frontend.should_skip # ... backend: diff --git a/action.yml b/action.yml index 067bf83..3d5a732 100644 --- a/action.yml +++ b/action.yml @@ -35,6 +35,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 e896fa9..70846fb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -456,7 +456,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 3cdaa59..0e14b53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -631,7 +631,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)