From 9f6b46a2b1b3b5bfd6532596b20c72f86bced5fc Mon Sep 17 00:00:00 2001 From: Philippe Auriach Date: Wed, 17 Jan 2024 14:23:59 +0100 Subject: [PATCH] Remove check for single commit and PR title (#78) --- lib/actions/pullRequest.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/actions/pullRequest.js b/lib/actions/pullRequest.js index 59654700..0cbf9c5f 100644 --- a/lib/actions/pullRequest.js +++ b/lib/actions/pullRequest.js @@ -11,16 +11,14 @@ exports.validatePR = async function validatePR({ pullRequest, issue }) { if (pullRequest) { const { number: pullNumber, - commits, base: { ref: baseRef, repo: { owner: { login: owner }, name: repo, }, - user: { login: committer }, }, - head: { ref: headRef, sha: headSha }, + head: { ref: headRef }, title, } = pullRequest; @@ -47,32 +45,6 @@ exports.validatePR = async function validatePR({ pullRequest, issue }) { ); } - if ( - commits === 1 && - !title.match(/^Revert ".*"/) && - !title.match(/^Bump .*/) && - committer !== "ms-bot" && - committer !== "ms-upgrade-aws" - ) { - // we have only one commit, make sure its name match the name of the PR - const { - data: { message: commitMessage }, - } = await octokit.rest.git.getCommit({ - owner, - repo, - commit_sha: headSha, - }); - if (commitMessage !== title) { - throw new Error( - `This pull request has only one commit, and its message doesn't match the title of the PR. If you'd like to keep the title of the PR as it is, please add an empty commit.` - ); - } else { - console.log( - "This pull request has only one commit, and its message matches the title of the PR." - ); - } - } - // everything seems valid: add the label if it exists const branchTag = headRef.split("/")[0];