+1, thanks for driving this. Here's the pseudo code for the PR labeling for 
better readability:

if WIP in title or PR is draft or CI failed:
    pr-work-in-progress
elif CI has not started yet or CI is in progress:
    pr-awaiting-testing
else: # CI passed checks
    if pr has at least one approval and no request changes:
        pr-awaiting-merge
    elif pr has no review or all reviews have been dismissed/re-requested:
        pr-awaiting-review
    else: # pr has a review that hasn't been dismissed yet no approval
        pr-awaiting-response

Best,
Sheng

On 2020/07/31 18:08:34, Chaitanya Bapat <[email protected]> wrote: 
> Hello MXNet community,
> 
> Banking on the success of mxnet-bot that has been triggering CI
> successfully for the past 3 months, Sheng proposed an idea for automatic PR
> labeling. I am working on the implementation of the same.
> 
> *What's the idea?*
> An automated way of labeling PRs based on the status of CI.
> 
> *Why?*
> 
> This serves dual purpose
> 
>    - Automates the labeling [currently manual]
>    - Allows contributors to prioritize review of PRs.
> 
> *How?*
> 1. Github webhook would send status update events to the Lambda function
> 2. Lambda would then label the CI based on following conditions
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> *if WIP in title or PR is draft or CI failed:    pr-work-in-progresselif CI
> has not started yet or CI is in progress:    pr-awaiting-testingelse: # CI
> passed checks    if pr has at least one approval and no request changes:
>     pr-awaiting-merge    elif pr has no review or all reviews have been
> dismissed/re-requested:        pr-awaiting-review    else: # pr has a
> review that hasn't been dismissed yet no approval
> pr-awaiting-response*
> 
> To that end, a POC was done to test if it's possible & result: it works.
> Results of 1 successful run on Prod for apache/incubator-mxnet repo
> 
> Open PRs : 207
> PRs labeled : 18
> PRs already labeled : 38
> PRs with unknown jobs : 2
> PRs with status failed : 149
> 
> Lambda function labeled 18 PRs that had passed all the tests.
> 
> PR for POC: https://github.com/apache/incubator-mxnet-ci/pull/27
> However, Marco made a valid point regarding leveraging Github Webhooks
> [instead of Jenkins] for retrieving status of the PR.
> 
> *What's required?*
> Thus, to get this feature functional, I'd need a separate Github webhook
> that sends information related to PR Status. Just like the webhook request
> for CI Bot, I can send the details over private email to Marco's personal
> email address & then he can create a ticket with Apache Infra.
> 
> Thanks to Sheng & Marco for guidance & assistance on this.
> 
> Thanks,
> Chai
> 
> -- 
> *Chaitanya Prakash Bapat*
> *+1 (973) 953-6299*
> 
> [image: https://www.linkedin.com//in/chaibapat25]
> <https://github.com/ChaiBapchya>[image: https://www.facebook.com/chaibapat]
> <https://www.facebook.com/chaibapchya>[image:
> https://twitter.com/ChaiBapchya] <https://twitter.com/ChaiBapchya>[image:
> https://www.linkedin.com//in/chaibapat25]
> <https://www.linkedin.com//in/chaibapchya/>
> 

Reply via email to