Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow release for do_not_skip input #273

Merged
merged 2 commits into from Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -135,7 +135,7 @@ If true, skip if an already finished duplicate run can be found.

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

Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`.
Possible values are `pull_request`, `push`, `workflow_dispatch`, `schedule`, `release`.

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

Expand Down
18 changes: 10 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 15 additions & 10 deletions src/main.ts
Expand Up @@ -16,7 +16,8 @@ const workflowRunTriggerOptions = [
'pull_request',
'push',
'workflow_dispatch',
'schedule'
'schedule',
'release'
] as const
type WorkflowRunTrigger = typeof workflowRunTriggerOptions[number]

Expand Down Expand Up @@ -305,7 +306,9 @@ class SkipDuplicateActions {
}
iterSha = commit.parents?.length ? commit.parents[0]?.sha : null
const changedFiles = commit.files
? commit.files.map(f => f.filename).filter(f => typeof f === 'string')
? commit.files
.map(file => file.filename)
.filter(file => typeof file === 'string')
: []
allChangedFiles.push(changedFiles)

Expand Down Expand Up @@ -417,11 +420,12 @@ class SkipDuplicateActions {
return null
}
try {
const res = await this.context.octokit.rest.repos.getCommit({
...this.context.repo,
ref: sha
})
return res.data
return (
await this.context.octokit.rest.repos.getCommit({
...this.context.repo,
ref: sha
})
).data
} catch (error) {
if (error instanceof Error || typeof error === 'string') {
core.warning(error)
Expand All @@ -441,9 +445,10 @@ async function main(): Promise<void> {
pathsFilter: getPathsFilterInput('paths_filter'),
doNotSkip: getDoNotSkipInput('do_not_skip'),
concurrentSkipping: getConcurrentSkippingInput('concurrent_skipping'),
cancelOthers: core.getBooleanInput('cancel_others') ?? false,
skipAfterSuccessfulDuplicates:
core.getBooleanInput('skip_after_successful_duplicate') ?? true
cancelOthers: core.getBooleanInput('cancel_others'),
skipAfterSuccessfulDuplicates: core.getBooleanInput(
'skip_after_successful_duplicate'
)
}

const repo = github.context.repo
Expand Down