public static Context ToContext(this ReleaseNotesRequest releaseNotesRequest)
        {
            var context = new Context();

            context.ProjectId = releaseNotesRequest.IssueTrackerProjectId;

            context.Repository.Url    = releaseNotesRequest.RepositoryUrl;
            context.Repository.Branch = releaseNotesRequest.RepositoryBranch;

            var lowercaseUrl = releaseNotesRequest.IssueTrackerUrl.ToLower();

            if (lowercaseUrl.Contains("bitbucket"))
            {
                context.BitBucket.Repo = releaseNotesRequest.IssueTrackerUrl;
            }

            if (lowercaseUrl.Contains("atlassian"))
            {
                context.Jira.JiraServer = releaseNotesRequest.IssueTrackerUrl;
            }

            if (lowercaseUrl.Contains("github"))
            {
                context.GitHub.Repo = releaseNotesRequest.IssueTrackerUrl;
            }

            if (lowercaseUrl.Contains("youtrack"))
            {
                context.YouTrack.YouTrackServer = releaseNotesRequest.IssueTrackerUrl;
            }

            return(context);
        }
        public async Task <IHttpActionResult> SetReleaseNotes(Guid packageId, ReleaseNotesRequest request)
        {
            ProgramUpdatePackageInfo pkg = await this.work.UpdatePackages.FirstOrDefaultAsync(x => x.PublicId == packageId).ConfigureAwait(false);

            pkg.ReleaseNotes = request.Notes;
            await this.work.CompleteAsync().ConfigureAwait(false);

            return(this.Ok(""));
        }
示例#3
0
        public async Task <IHttpActionResult> SetReleaseNotes(Guid packageId, ReleaseNotesRequest request)
        {
            ProgramUpdatePackageInfo pkg = await this.work.UpdatePackages.FirstOrDefaultAsync(x => x.PublicId == packageId).ConfigureAwait(false);

            Trace.TraceInformation(LoggerHelper.FormatMessage(this.RequestContext, $"Setting release notes on package {pkg.Id}"));

            pkg.ReleaseNotes = request.Notes;
            await this.work.CompleteAsync().ConfigureAwait(false);

            return(this.Ok(""));
        }
        public async Task <HttpResponseMessage> Generate([FromBody] ReleaseNotesRequest releaseNotesRequest)
        {
            Argument.IsNotNull(() => releaseNotesRequest);

            var context = releaseNotesRequest.ToContext();

            context.AllTags = true;

            var releaseNotes = _releaseNotesService.GetReleaseNotes(context);

            return(new HttpResponseMessage
            {
                Content = new JsonContent(releaseNotes)
            });
        }
        public async Task <HttpResponseMessage> Generate([FromBody] ReleaseNotesRequest releaseNotesRequest)
        {
            Argument.IsNotNull(() => releaseNotesRequest);

            var context1 = new ReleaseNotesGenerationParameters
            {
                RepositorySettings =
                {
                    Url    = releaseNotesRequest.RepositoryUrl,
                    Branch = releaseNotesRequest.RepositoryBranch
                },
                IssueTracker = { ProjectId = releaseNotesRequest.IssueTrackerProjectId }
            };

            var context = context1;

            context.AllTags = true;
            var releaseNotes = await releaseNotesService.GetReleaseNotesAsync(context);

            return(new HttpResponseMessage
            {
                Content = new JsonContent(releaseNotes)
            });
        }