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
14 changes: 6 additions & 8 deletions .github/workflows/cla-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ jobs:
// This may be valid but will require an admin to ok it
const invalidModify = signedOnBase && contributorsModified;

// CLA is met if:
// * Didn't Invalidly Modify the CONTRIBUTORS and
// * signed on either base or PR
const cla_met = !invalidModify && (signedOnBase || signedOnPr);

// Helper function to create or update a label with a specific COLOUR
async function ensureLabel(name, COLOUR, description) {
try {
Expand Down Expand Up @@ -215,7 +210,7 @@ jobs:
}
}

console.log(`CLA Met: ${cla_met} (Base: ${signedOnBase}, PR: ${signedOnPr}, Modified: ${contributorsModified}, Invalid Modify: ${invalidModify})`);
console.log(`Base: ${signedOnBase}, PR: ${signedOnPr}, Modified: ${contributorsModified}, Invalid Modify: ${invalidModify}`);

// Handle case where contributor modified the file when already on it
if (invalidModify) {
Expand All @@ -225,6 +220,7 @@ jobs:
// Ensure labels are correct
await Promise.allSettled([
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-signed' }),
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-required' }),
github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['cla-modified'] })
]);

Expand All @@ -241,7 +237,7 @@ jobs:
process.exit(1);
}

if (cla_met) {
if (signedOnBase) {

// Different messages based on scenario
if (signedOnBase && !contributorsModified) {
Expand All @@ -258,12 +254,13 @@ jobs:
// Delete old CLA comments since CLA is satisfied
await deleteOldClaComments();

} else if (!signedOnBase && signedOnPr) {
} else if (signedOnPr) {
// New contributor signing CLA for the first time
await ensureLabel('cla-signed', COLOUR_SIGNED, 'The CLA has been signed as part of this PR - added by GA');
console.log('✅ New contributor has signed the CLA in PR branch.');
await Promise.allSettled([
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-required' }),
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-modified' }),
github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['cla-signed'] })
]);

Expand All @@ -277,6 +274,7 @@ jobs:
// Ensure labels are correct
await Promise.allSettled([
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-signed' }),
github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'cla-modified' }),
github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['cla-required'] })
]);

Expand Down
Loading