Skip to content

Commit

Permalink
When CLA is failing create a review with requested changes (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored Oct 3, 2023
1 parent 0ce72d2 commit 3003115
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions services/bots/src/github-webhook/handlers/validate-cla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ export class ValidateCla extends BaseWebhookHandler {
}

if (commitsWithoutLogins.length) {
context.scheduleIssueComment({
handler: botContextName,
comment: noLoginOnShaComment(
commitsWithoutLogins,
context.payload.pull_request.user.login,
`https://github.com/${context.payload.repository.full_name}/pull/${context.payload.number}/commits/`,
),
});
await context.github.pulls.createReview(
context.pullRequest({
body: noLoginOnShaComment(
commitsWithoutLogins,
context.payload.pull_request.user.login,
`https://github.com/${context.payload.repository.full_name}/pull/${context.payload.number}/commits/`,
),
event: 'REQUEST_CHANGES',
}),
);

context.scheduleIssueLabel(ClaIssueLabel.CLA_ERROR);

Expand All @@ -137,13 +139,15 @@ export class ValidateCla extends BaseWebhookHandler {
}

if (authorsNeedingCLA.length) {
context.scheduleIssueComment({
handler: botContextName,
comment: pullRequestComment(
uniqueEntries(authorsNeedingCLA.map((entry) => `@${entry.login}`)),
`${context.payload.repository.full_name}#${context.payload.number}`,
),
});
await context.github.pulls.createReview(
context.pullRequest({
body: pullRequestComment(
uniqueEntries(authorsNeedingCLA.map((entry) => `@${entry.login}`)),
`${context.payload.repository.full_name}#${context.payload.number}`,
),
event: 'REQUEST_CHANGES',
}),
);
context.scheduleIssueLabel(ClaIssueLabel.CLA_NEEDED);

authorsNeedingCLA.forEach((entry) =>
Expand Down

0 comments on commit 3003115

Please sign in to comment.