Skip to content

Commit

Permalink
Merge pull request #20 from Okabe-Junya/junya/feat/issue-type-both
Browse files Browse the repository at this point in the history
feat: issue-type: both
  • Loading branch information
Okabe-Junya authored Sep 25, 2023
2 parents 55e77a4 + e5e7f69 commit 0a63e5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
github-token:
description: 'token for github'
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
issue-type:
description: 'validate for issue or pull request. if you want to validate pull request, you must set issue-type: "pull_request". Both issue and pull request are validated, if you set issue-type: "both". default is "issue"'
required: false
default: 'issue'
is-auto-close:
description: 'auto close issue if it does not meet the conditions'
required: false
Expand Down
4 changes: 2 additions & 2 deletions src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function validateIssueTitleAndBody(
if (!titleRegex && !bodyRegex) {
return true;
}
if (issueType === 'issue') {
if (issueType === 'issue' || issueType === 'both') {
const { title, body } = await getIssueTitleAndBody(issueNumber);
if (titleRegex && !validate(titleRegex, title)) {
return false;
Expand All @@ -19,7 +19,7 @@ export async function validateIssueTitleAndBody(
}
return true;
}
if (issueType === 'pull_request') {
if (issueType === 'pull_request' || issueType === 'both') {
const { title, body } = await getPullRequestTitleAndBody(issueNumber);
if (titleRegex && !validate(titleRegex, title)) {
return false;
Expand Down

0 comments on commit 0a63e5f

Please sign in to comment.