Exemplo n.º 1
0
        /// <summary>
        ///     Synchronizes an in progress pull request.
        ///     This will update current state if the pull request has been manually closed or merged.
        ///     This will evaluate merge policies on an in progress pull request and merge the pull request if policies allow.
        /// </summary>
        /// <returns>
        ///     A <see cref="ValueTuple{InProgressPullRequest, bool}" /> containing:
        ///     The current open pull request if one exists, and
        ///     <see langword="true" /> if the open pull request can be updated; <see langword="false" /> otherwise.
        /// </returns>
        public virtual async Task <(InProgressPullRequest pr, bool canUpdate)> SynchronizeInProgressPullRequestAsync()
        {
            ConditionalValue <InProgressPullRequest> maybePr =
                await StateManager.TryGetStateAsync <InProgressPullRequest>(PullRequest);

            if (maybePr.HasValue)
            {
                InProgressPullRequest pr = maybePr.Value;
                if (string.IsNullOrEmpty(pr.Url))
                {
                    // somehow a bad PR got in the collection, remove it
                    await StateManager.RemoveStateAsync(PullRequest);

                    return(null, false);
                }

                bool?result = await ActionRunner.ExecuteAction(() => SynchronizePullRequestAsync(pr.Url));

                if (result == true)
                {
                    return(pr, true);
                }

                if (result == false)
                {
                    return(pr, false);
                }
            }

            await Reminders.TryUnregisterReminderAsync(PullRequestCheck);

            return(null, false);
        }
Exemplo n.º 2
0
 Task ISubscriptionActor.UpdateAsync(int buildId)
 {
     return(ActionRunner.ExecuteAction(() => UpdateAsync(buildId)));
 }
Exemplo n.º 3
0
 public Task <string> RunActionAsync(string method, string arguments)
 {
     return(ActionRunner.RunAction(this, method, arguments));
 }
Exemplo n.º 4
0
 public Task RunProcessPendingUpdatesAsync()
 {
     return(ActionRunner.ExecuteAction(() => ProcessPendingUpdatesAsync()));
 }
Exemplo n.º 5
0
 Task IPullRequestActor.UpdateAssetsAsync(Guid subscriptionId, int buildId, string sourceSha, List <Asset> assets)
 {
     return(ActionRunner.ExecuteAction(() => UpdateAssetsAsync(subscriptionId, buildId, sourceSha, assets)));
 }