diff --git a/.gitignore b/.gitignore index 1af3ecf8..69db617a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __tests__/runner/* .vscode node_modules lib +.idea diff --git a/src/addEmptyCommit.ts b/src/addEmptyCommit.ts index 01d41d2a..1d90454c 100644 --- a/src/addEmptyCommit.ts +++ b/src/addEmptyCommit.ts @@ -3,6 +3,7 @@ import { context } from '@actions/github' import * as core from '@actions/core' import * as input from './shared/getInputs' +import { getPrSignComment } from './shared/pr-sign-comment' export async function addEmptyCommit() { @@ -11,8 +12,8 @@ export async function addEmptyCommit() { if (context.payload.comment) { - //Do empty commit only when the contributor signs the CLA with the PR comment - if (context.payload.comment.body === 'I have read the CLA Document and I hereby sign the CLA') { + //Do empty commit only when the contributor signs the CLA with the PR comment + if (context.payload.comment.body.toLowerCase().trim() === getPrSignComment().toLowerCase().trim()) { try { const message = input.getSignedCommitMessage() ? input.getSignedCommitMessage().replace('$contributorName', contributorName) : diff --git a/src/pullrequest/pullRequestCommentContent.ts b/src/pullrequest/pullRequestCommentContent.ts index 28a86df8..954ce9ce 100644 --- a/src/pullrequest/pullRequestCommentContent.ts +++ b/src/pullrequest/pullRequestCommentContent.ts @@ -2,6 +2,7 @@ import { CommitterMap } from '../interfaces' import * as input from '../shared/getInputs' +import { getPrSignComment } from '../shared/pr-sign-comment' export function commentContent(signed: boolean, committerMap: CommitterMap): string { // using a `string` true or false purposely as github action input cannot have a boolean value @@ -72,7 +73,7 @@ function cla(signed: boolean, committerMap: CommitterMap): string { let lineOne = (input.getCustomNotSignedPrComment() || `
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that $you sign our [Contributor License Agreement](${input.getPathToDocument()}) before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.
`).replace('$you', you) let text = `**CLA Assistant Lite bot:** ${lineOne} - - - - ${input.getCustomPrSignComment() || "I have read the CLA Document and I hereby sign the CLA"} + ${getPrSignComment()} - - - ` @@ -94,4 +95,4 @@ function cla(signed: boolean, committerMap: CommitterMap): string { text += 'You can retrigger this bot by commenting **recheck** in this Pull Request' return text -} \ No newline at end of file +} diff --git a/src/shared/pr-sign-comment.ts b/src/shared/pr-sign-comment.ts new file mode 100644 index 00000000..7c4b3e33 --- /dev/null +++ b/src/shared/pr-sign-comment.ts @@ -0,0 +1,5 @@ +import * as input from './getInputs' + +export function getPrSignComment() { + return input.getCustomPrSignComment() || "I have read the CLA Document and I hereby sign the CLA" +}