Skip to content
Merged
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
18 changes: 13 additions & 5 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ jobs:
});
};

const upsertStatusComment = async (body) => {
const upsertStatusComment = async (body, { create }) => {
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
Expand All @@ -247,7 +247,7 @@ jobs:
comment_id: existing.id,
body,
});
} else {
} else if (create) {
await github.rest.issues.createComment({
owner,
repo,
Expand Down Expand Up @@ -324,10 +324,18 @@ jobs:
? unknownCommits.map((commit) => `- ${commit.sha} by ${commit.name} <${commit.email}>`).join('\n')
: '- None';

const body = `${marker}
// A passing PR gets no comment of its own. One left over from an earlier failing run is
// still updated, so it stops asking for signatures that have since landed.
const passedBody = `${marker}
## Contributor License Agreement

${hasPassed ? 'All identified human contributors have signed the current CLA.' : 'This pull request cannot be merged until the CLA check passes.'}
All identified human contributors have signed the current CLA.
`.replace(/^ {12}/gm, '').trim();

const failedBody = `${marker}
## Contributor License Agreement

This pull request cannot be merged until the CLA check passes.

Current CLA: ${agreement.url}

Expand All @@ -348,7 +356,7 @@ jobs:
If you already signed, comment \`recheck cla\`.
`.replace(/^ {12}/gm, '').trim();

await upsertStatusComment(body);
await upsertStatusComment(hasPassed ? passedBody : failedBody, { create: !hasPassed });

if (hasPassed) {
await createCommitStatus('success', 'All identified contributors signed the CLA');
Expand Down
Loading