コード例 #1
0
        /// <summary>
        /// Adds the <see cref="PullRequestSignOff"/> for a given <paramref name="pullRequest"/>
        /// </summary>
        /// <param name="pullRequest">The <see cref="PullRequest"/> to sign off</param>
        /// <param name="user">The <see cref="User"/> doing the signing</param>
        /// <param name="token">The api token for <paramref name="user"/></param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
        /// <returns>A <see cref="Task"/> representing the running operation</returns>
        public async Task SignOff(PullRequest pullRequest, User user, string token, CancellationToken cancellationToken)
        {
            if (pullRequest == null)
            {
                throw new ArgumentNullException(nameof(pullRequest));
            }
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }
            await dataStore.WriteData(pullRequest.Number.ToString(CultureInfo.InvariantCulture), new PullRequestSignOff { AccessToken = token }, cancellationToken).ConfigureAwait(false);

            await gitHubManager.ApprovePullRequest(pullRequest, stringLocalizer["SignerTag", user.Login]).ConfigureAwait(false);
        }