Skip to content

Commit

Permalink
add log warnings to gh api
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Jul 29, 2024
1 parent 36e7a24 commit 695b83f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions GitHubApi.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Net.Http.Headers;
using System.Text.Json;
using GithubActionsOrchestrator.GitHub;
using Npgsql.Replication;
using Serilog;
using Serilog.Core;

Expand All @@ -26,6 +27,8 @@ public static async Task<GitHubRunners> GetRunnersForOrg(string githubToken, str
GitHubRunners responseObject = JsonSerializer.Deserialize<GitHubRunners>(content);
return responseObject;
}

Log.Warning($"Unable to get GH runners for org: [{response.StatusCode}] {response.ReasonPhrase}");

return null;
}
Expand All @@ -48,8 +51,7 @@ public static async Task<GitHubRunners> GetRunnersForRepo(string githubToken, st
GitHubRunners responseObject = JsonSerializer.Deserialize<GitHubRunners>(content);
return responseObject;
}

Log.Error($"Unable to talk to GitHub. Check Token.");
Log.Warning($"Unable to get GH runners for repo: [{response.StatusCode}] {response.ReasonPhrase}");
return null;
}
public static async Task<string> GetRunnerTokenForOrg(string githubToken, string orgName)
Expand All @@ -71,6 +73,7 @@ public static async Task<string> GetRunnerTokenForOrg(string githubToken, string
GitHubResponse responseObject = JsonSerializer.Deserialize<GitHubResponse>(content);
return responseObject?.token;
}
Log.Warning($"Unable to get GH runner token for org: [{response.StatusCode}] {response.ReasonPhrase}");

return null;
}
Expand All @@ -93,6 +96,7 @@ public static async Task<string> GetRunnerTokenForRepo(string githubToken, strin
GitHubResponse responseObject = JsonSerializer.Deserialize<GitHubResponse>(content);
return responseObject?.token;
}
Log.Warning($"Unable to get GH runner token for repo: [{response.StatusCode}] {response.ReasonPhrase}");

return null;
}
Expand Down

0 comments on commit 695b83f

Please sign in to comment.