Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore OverflowException when posting comments on PRs #65

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading