Skip to content

Commit

Permalink
Ignore OverflowException when posting comments on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
karashiiro committed Jun 6, 2024
1 parent 60ddb63 commit d0d172a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Plogon/GitHubApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ public GitHubApi(string repoOwner, string repoName, string token)
Credentials = new Credentials(token)
};
}

/// <summary>
/// Authenticated GitHub client.
/// </summary>
public GitHubClient Client => this.ghClient;

/// <summary>
/// Repo owner.
/// </summary>
public string RepoOwner => this.repoOwner;

/// <summary>
/// Repo name.
/// </summary>
Expand All @@ -55,7 +55,14 @@ public GitHubApi(string repoOwner, string repoName, string token)
/// <param name="body">The body</param>
public async Task AddComment(int issueNumber, string body)
{
await this.ghClient.Issue.Comment.Create(repoOwner, repoName, issueNumber, body);
try
{
await this.ghClient.Issue.Comment.Create(repoOwner, repoName, issueNumber, body);
}
catch (OverflowException)
{
// Explicitly ignored (octokit/octokit.net#2927)
}
}

/// <summary>
Expand Down Expand Up @@ -125,15 +132,15 @@ public async Task<string> GetIssueBody(int issueNumber)
{
return await this.ghClient.PullRequest.Get(repoOwner, repoName, number);
}

/// <summary>
/// Add an assignee.
/// </summary>
/// <param name="number">The PR number.</param>
/// <param name="assignee">GitHub login to assign.</param>
public async Task Assign(int number, string assignee)
{
await this.ghClient.Issue.Assignee.AddAssignees(repoOwner, repoName, number, new AssigneesUpdate(new []{ assignee }));
await this.ghClient.Issue.Assignee.AddAssignees(repoOwner, repoName, number, new AssigneesUpdate(new[] { assignee }));
}

/// <summary>
Expand Down

0 comments on commit d0d172a

Please sign in to comment.