Skip to content

Commit

Permalink
Implement GetLinkedIssuesAsync in GitLab provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Nov 15, 2023
1 parent dfc9533 commit 4f002b8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/GitReleaseManager.Core/Provider/GitLabProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,23 @@ public string GetIssueType(Issue issue)
return issue.IsPullRequest ? "Merge Request" : "Issue";
}

public async Task<Issue> GetLinkedIssueAsync(string owner, string repository, int issueNumber)
public Task<IEnumerable<Issue>> GetLinkedIssuesAsync(string owner, string repository, Issue issue)
{
// This is a placeholder until I figure out if GitLab has a something equivalent to GitHub's "linked issue"
throw new NotImplementedException();
return ExecuteAsync(() =>
{
if (issue.IsPullRequest)
{
var closes = _gitLabClient.MergeRequests.ClosesIssues(issue.PublicNumber);
var issues = _mapper.Map<IEnumerable<Issue>>(closes);
return Task.FromResult(issues);
}
else
{
var closedBy = _gitLabClient.Issues.ClosedBy(GetGitLabProjectId(owner, repository), issue.PublicNumber);
var issues = _mapper.Map<IEnumerable<Issue>>(closedBy);
return Task.FromResult(issues);
}
});
}

private int GetGitLabProjectId(string owner, string repository)
Expand Down

0 comments on commit 4f002b8

Please sign in to comment.