Skip to content

Commit

Permalink
Remove check for single commit and PR title (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach authored Jan 17, 2024
1 parent 1c208ee commit 9f6b46a
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions lib/actions/pullRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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];

Expand Down

0 comments on commit 9f6b46a

Please sign in to comment.