Skip to content

Commit b807605

Browse files
authored
Allow release for do_not_skip input (#273)
* Allow 'release' as option for 'do_not_skip' input * Small optimizations * Use meaningful variable ('file' vs. 'f') * Remove unnecessary default values for boolean inputs * Directly return commit response (remove 'res' variable)
1 parent 0eb36ff commit b807605

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ If true, skip if an already finished duplicate run can be found.
135135

136136
A JSON-array with triggers that should never be skipped.
137137

138-
Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`.
138+
Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`, `release`.
139139

140140
**Default:** `'["workflow_dispatch", "schedule"]'`
141141

dist/index.js

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const workflowRunTriggerOptions = [
1616
'pull_request',
1717
'push',
1818
'workflow_dispatch',
19-
'schedule'
19+
'schedule',
20+
'release'
2021
] as const
2122
type WorkflowRunTrigger = typeof workflowRunTriggerOptions[number]
2223

@@ -305,7 +306,9 @@ class SkipDuplicateActions {
305306
}
306307
iterSha = commit.parents?.length ? commit.parents[0]?.sha : null
307308
const changedFiles = commit.files
308-
? commit.files.map(f => f.filename).filter(f => typeof f === 'string')
309+
? commit.files
310+
.map(file => file.filename)
311+
.filter(file => typeof file === 'string')
309312
: []
310313
allChangedFiles.push(changedFiles)
311314

@@ -417,11 +420,12 @@ class SkipDuplicateActions {
417420
return null
418421
}
419422
try {
420-
const res = await this.context.octokit.rest.repos.getCommit({
421-
...this.context.repo,
422-
ref: sha
423-
})
424-
return res.data
423+
return (
424+
await this.context.octokit.rest.repos.getCommit({
425+
...this.context.repo,
426+
ref: sha
427+
})
428+
).data
425429
} catch (error) {
426430
if (error instanceof Error || typeof error === 'string') {
427431
core.warning(error)
@@ -441,9 +445,10 @@ async function main(): Promise<void> {
441445
pathsFilter: getPathsFilterInput('paths_filter'),
442446
doNotSkip: getDoNotSkipInput('do_not_skip'),
443447
concurrentSkipping: getConcurrentSkippingInput('concurrent_skipping'),
444-
cancelOthers: core.getBooleanInput('cancel_others') ?? false,
445-
skipAfterSuccessfulDuplicates:
446-
core.getBooleanInput('skip_after_successful_duplicate') ?? true
448+
cancelOthers: core.getBooleanInput('cancel_others'),
449+
skipAfterSuccessfulDuplicates: core.getBooleanInput(
450+
'skip_after_successful_duplicate'
451+
)
447452
}
448453

449454
const repo = github.context.repo

0 commit comments

Comments
 (0)