Esempio n. 1
0
 public async Task <bool> IsReadyToMerge(GithubPullRequestDTO PR)
 {
     if (PR.state == "open")
     {
         if (await IsApproved(PR))
         {
             if (await IsMergeable(PR))
             {
                 if (SatisfiesLabels(PR))
                 {
                     return(true);
                 }
                 else
                 {
                     var message = $"Flag removal PR opened by {PR.user.login} is open, approved, mergeable but does not satisfy Date restrictions: [Link]({PR.url})";
                     _logger.alertFlowdock(message);
                 }
             }
             else
             {
                 var message = $"Flag removal PR opened by {PR.user.login} is open, and approved but not mergeable: [Link]({PR.url})";
                 _logger.alertFlowdock(message);
             }
         }
         else
         {
             var message = $"Flag removal PR opened by {PR.user.login} is open but not approved: [Link]({PR.url})";
             _logger.alertFlowdock(message);
         }
     }
     return(false);
 }
Esempio n. 2
0
        private async Task ProcessPRForFlag(GithubPullRequestDTO PR, string flag)
        {
            var ready = await _api.IsReadyToMerge(PR);

            if (ready)
            {
                var response = await _api.MergePR(PR);

                if (response.merged)
                {
                    _flowdock.alertFlowdock($"[PR]({PR.url}) for the removal of {flag} has been automatically merged");
                }
                else
                {
                    _flowdock.alertFlowdock($"[PR]({PR.url}) for the removal of {flag} failed to merge automatically - {response.message}");
                }
            }
        }