From 90a12f793506fe60cc22c1bc9ce6f5d61dab8e45 Mon Sep 17 00:00:00 2001 From: Gary Ewan Park Date: Fri, 8 Sep 2023 10:57:16 +0100 Subject: [PATCH] (#146) Introduce the concept of IsPullRequest Within GitHub, an issue and a pull request are essentially the same thing, at least in terms of how GRM uses them. However, in GitLab, they are uniquely different, and have their own unique numbers, where as in GitHub an issue or pull request just get the next number for the repository. So that we don't have to change too many things in GRM, let's introduce the concept of an IsPullRequest property to the issue model, that way the VcsProvider can provide this information if required, and then use the information to do the right thing when it comes to fetching and updating the information, but internally, GRM will just have a collection of issues, which it then acts on when required. --- .../MappingProfiles/GitHubProfile.cs | 1 + src/GitReleaseManager.Core/Model/Issue.cs | 2 ++ src/GitReleaseManager.Core/Provider/GitHubProvider.cs | 5 +++++ src/GitReleaseManager.Core/Provider/IVcsProvider.cs | 2 ++ .../Templates/default/issue-note.sbn | 7 ++++++- src/GitReleaseManager.Core/VcsService.cs | 5 +++-- 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/GitReleaseManager.Core/MappingProfiles/GitHubProfile.cs b/src/GitReleaseManager.Core/MappingProfiles/GitHubProfile.cs index 94611729..afa1f072 100644 --- a/src/GitReleaseManager.Core/MappingProfiles/GitHubProfile.cs +++ b/src/GitReleaseManager.Core/MappingProfiles/GitHubProfile.cs @@ -10,6 +10,7 @@ public GitHubProfile() CreateMap() .ForMember(dest => dest.PublicNumber, act => act.MapFrom(src => src.Number)) .ForMember(dest => dest.InternalNumber, act => act.MapFrom(src => src.Id)) + .ForMember(dest => dest.IsPullRequest, act => act.MapFrom(src => src.HtmlUrl.Contains("/pull/"))) .ReverseMap(); CreateMap().ReverseMap(); CreateMap().ReverseMap(); diff --git a/src/GitReleaseManager.Core/Model/Issue.cs b/src/GitReleaseManager.Core/Model/Issue.cs index 55aae49d..7914672f 100644 --- a/src/GitReleaseManager.Core/Model/Issue.cs +++ b/src/GitReleaseManager.Core/Model/Issue.cs @@ -13,5 +13,7 @@ public sealed class Issue public string HtmlUrl { get; set; } public IReadOnlyList