Skip to content
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

feat: check fast-track approvals #588

Merged
merged 3 commits into from
Dec 5, 2021

Conversation

Mesteery
Copy link
Member

@Mesteery Mesteery commented Nov 2, 2021

No description provided.

@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #588 (5330b2e) into main (a23a96e) will decrease coverage by 2.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #588      +/-   ##
==========================================
- Coverage   82.57%   80.39%   -2.19%     
==========================================
  Files          35       37       +2     
  Lines        1750     1846      +96     
==========================================
+ Hits         1445     1484      +39     
- Misses        305      362      +57     
Impacted Files Coverage Δ
lib/pr_checker.js 97.38% <100.00%> (+0.16%) ⬆️
lib/utils.js 63.33% <0.00%> (-36.67%) ⬇️
lib/verbosity.js 61.53% <0.00%> (ø)
lib/run.js 18.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a23a96e...5330b2e. Read the comment docs.

r.user.login !== requestor &&
collaborators.includes(r.user.login))) {
cli.error('The fast-track request requires' +
" at least one collaborator's 👍.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast tracking requires two collaborator approvals.

The pull request can be fast-tracked if two collaborators approve the fast-tracking request. To land, the pull request itself still needs two collaborator approvals and a passing CI.

Ref: https://github.com/nodejs/node/blob/86099a375af95f519ae699b68ce101aa20236c5f/doc/guides/collaborator-guide.md#waiting-for-approvals

Would it be possible to implement logic such that it checks to see if the person that requested fast-tracking is also the author of the PR and, if so, checks for two collaborator fast-track 👍 reactions, and otherwise accepts one collaborator fast-track 👍 reaction as long as it's not a 👍 from either the PR author or the collaborator proposing fast-tracking?

In other words:

If fast-track requester is PR author:
    Require 2 👍 reactions from collaborators who are not the PR author
else:
    Require 1 👍 reaction from a collaborator who is not the PR author or the collaborator who requested fast-tracking

@Trott
Copy link
Member

Trott commented Nov 3, 2021

Thanks for tackling this problem. The absence of fast-track confirmation is definitely a good loophole to fix!

@targos targos requested a review from Trott November 14, 2021 10:01
@@ -9,6 +9,8 @@ const WAIT_TIME_SINGLE_APPROVAL = 24 * 7;

const GITHUB_SUCCESS_CONCLUSIONS = ['SUCCESS', 'NEUTRAL', 'SKIPPED'];

const FAST_TRACK_RE = /^Fast-track has been requested by @(.+?)\. Please 👍 to approve\.$/;
Copy link
Contributor

@aduh95 aduh95 Nov 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to loosen this regex so if the wording of the comment changes in the future, it doesn't require to update ncu? (I don't see why we would need to change the wording anyway, so definitely not a blocking comment, just a thought)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but I'm afraid it would match a comment that is not a fast-track request (eg. if someone quotes the fast-track request comment).

lib/pr_checker.js Outdated Show resolved Hide resolved
Mesteery and others added 2 commits November 16, 2021 22:53
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@Mesteery
Copy link
Member Author

ping @Trott

@targos targos merged commit d0215d6 into nodejs:main Dec 5, 2021
@Mesteery Mesteery deleted the check-fast-track-approvals branch December 5, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants