From b8804255d701828d3647d6326a6d4aeda6df34b4 Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Mon, 25 Sep 2023 23:57:24 +0900 Subject: [PATCH 1/2] update: both --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) 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 From 0cbe9ff01dbc63b7d3f7546a3c479a1ed4450420 Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Mon, 25 Sep 2023 23:57:37 +0900 Subject: [PATCH 2/2] feat: can choose both --- src/validate.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;