-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing review state to APPROVED whe 'LGTM' in COMMENTED review #72
Changes from 1 commit
ed5b97e
4c15b16
0992b79
37cff9d
a053af6
0868d7a
f43df7e
b9b6608
42113f1
3e5c88a
f3f4afb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ const WEEKDAY_WAIT = 48; | |
const WEEKEND_WAIT = 72; | ||
|
||
const { | ||
REVIEW_SOURCES: { FROM_COMMENT, FROM_REVIEW, FROM_REVIEW_COMMENT } | ||
REVIEW_SOURCES: { FROM_COMMENT } | ||
} = require('./reviews'); | ||
const { | ||
FIRST_TIME_CONTRIBUTOR, FIRST_TIMER | ||
|
@@ -65,7 +65,7 @@ class PRChecker { | |
|
||
getTSCHint(people) { | ||
const tsc = people | ||
.filter((p) => p.review.source === FROM_REVIEW && p.reviewer.isTSC()) | ||
.filter((p) => p.reviewer.isTSC()) | ||
.map((p) => p.reviewer.login); | ||
let hint = ''; | ||
if (tsc.length > 0) { | ||
|
@@ -77,7 +77,7 @@ class PRChecker { | |
|
||
checkReviews() { | ||
const { | ||
pr, logger, reviewers: { rejected, approved, commentApproved } | ||
pr, logger, reviewers: { rejected, approved } | ||
} = this; | ||
let status = true; | ||
|
||
|
@@ -95,12 +95,8 @@ class PRChecker { | |
status = false; | ||
logger.warn(`Approvals: 0`); | ||
} else { | ||
let notComm = approved.length; | ||
approved.map((r) => { | ||
if (r.review.source !== FROM_REVIEW) { notComm--; } | ||
}); | ||
let hint = this.getTSCHint(approved); | ||
logger.info(`Approvals: ${notComm}${hint}`); | ||
logger.info(`Approvals: ${approved.length}${hint}`); | ||
|
||
for (const { reviewer, review } of approved) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be merged with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean the two blocks nearly repeating themselves? It probably needs refactoring yes, but I wanted advice on the workflow yet :) |
||
if (review.source === FROM_COMMENT) { | ||
|
@@ -118,16 +114,6 @@ class PRChecker { | |
} | ||
} | ||
} | ||
if (commentApproved && commentApproved.length !== 0) { | ||
let hint = this.getTSCHint(approved); | ||
logger.info(`LGTM in commented review: ${commentApproved.length}${hint}`); | ||
for (const { reviewer, review } of commentApproved) { | ||
if (review.source === FROM_REVIEW_COMMENT) { | ||
logger.info( | ||
`${reviewer.getName()} approved in via LGTM in commented review`); | ||
} | ||
} | ||
} | ||
|
||
return status; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can build something like
approvalFromReview
and use that from here, so we don't need to do the filtering ingetTSCHint
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to look into this!