Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ inputs:
description: "GitHub Actions will add empty commit whenever the user signs the CLA (optional)"
default: true
allowlist:
description: "users in the allow list don't have to sign the CLA document"
description: "Users in the allow list don't have to sign the CLA document"
path-to-cla-document:
description: "Fully qualified web link to cla document Example: https://github.com/cla-assistant/github-action/blob/master/SAPCLA.md"
signed-comment-message:
description: "Commit message when a new contributor signs the CLA in a PR"
request-comment-message:
description: "Introductory message to ask new contributors to sign"
signed-empty-commit-message:
description: "Commit message when a new contributor signs the CLA (empty)"
create-file-commit-message:
description: "Commit message when a new file is created"
all-signed-comment-message:
description: "Commit message when everyone has signed, defaults to **CLA Assistant Lite** All Contributors have signed the CLA."
runs:
using: "node12"
main: "lib/main.js"
7 changes: 5 additions & 2 deletions src/addEmptyCommit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export async function addEmptyCommit() {
//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') {
try {
const message = ` @${contributorName} has signed the CLA `
const commitMessage = core.getInput('signed-empty-commit-message')
const message = commitMessage ?
commitMessage.replace('$contributorName', contributorName) :
` @${contributorName} has signed the CLA `
const pullRequestResponse = await octokit.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down Expand Up @@ -52,4 +55,4 @@ export async function addEmptyCommit() {
}
}
return
}
}
7 changes: 6 additions & 1 deletion src/checkcla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,29 @@ function prepareCommiterMap(committers: CommittersDetails[], clas): CommitterMap
}
//TODO: refactor the commit message when a project admin does recheck PR
async function updateFile(pathToClaSignatures, sha, contentBinary, branch, pullRequestNo) {
const commitMessage = core.getInput('signed-commit-message')
await octokit.repos.createOrUpdateFile({
owner: context.repo.owner,
repo: context.repo.repo,
path: pathToClaSignatures,
sha: sha,
message: `@${context.actor} has signed the CLA from Pull Request ${pullRequestNo}`,
message: commitMessage ?
commitMessage.replace('$contributorName', context.actor).replace('$pullRequestNo', pullRequestNo) :
`@${context.actor} has signed the CLA from Pull Request ${pullRequestNo}`,
content: contentBinary,
branch: branch
})
}

function createFile(pathToClaSignatures, contentBinary, branch): Promise<object> {
/* TODO: add dynamic message content */
const commitMessage = core.getInput('create-file-commit-message')
return octokit.repos.createOrUpdateFile({
owner: context.repo.owner,
repo: context.repo.repo,
path: pathToClaSignatures,
message:
commitMessage ||
'Creating file for storing CLA Signatures',
content: contentBinary,
branch: branch
Expand Down
5 changes: 3 additions & 2 deletions src/pullRequestComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ function commentContent(signed: boolean, committerMap: CommitterMap): string {
const pathToCLADocument = core.getInput('path-to-cla-document')

if (signed) {
return `**CLA Assistant Lite** All Contributors have signed the CLA. `
return core.getInput('all-signed-comment-message') || `**CLA Assistant Lite** All Contributors have signed the CLA.`
}
let committersCount = 1
if (committerMap && committerMap.signed && committerMap.notSigned) {
committersCount =
committerMap.signed.length + committerMap.notSigned.length
}
let you = committersCount > 1 ? "you all" : "you"
let text = `**CLA Assistant Lite:** <br/>Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that ${you} sign our [Contributor License Agreement](${pathToCLADocument}) before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.
let lineOne = (core.getInput('request-comment-message') || '**CLA Assistant Lite:** <br/>Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that $you sign our [Contributor License Agreement]($pathToCLADocument) before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.').replace('$pathToCLADocument', pathToCLADocument).replace('$you', you)
let text = `${lineOne}
- - -
***I have read the CLA Document and I hereby sign the CLA***
- - -
Expand Down