diff --git a/action.yml b/action.yml index 12e0f19..a2da148 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/src/validate.ts b/src/validate.ts index 182bce5..cad2cee 100644 --- a/src/validate.ts +++ b/src/validate.ts @@ -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; @@ -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;