Skip to content

Commit

Permalink
Fix message with expected location of .githubtoken file (#1)
Browse files Browse the repository at this point in the history
Fix message with expected location of .githubtoken file
  • Loading branch information
blairconrad authored Dec 18, 2019
2 parents 77542ac + d5f0651 commit f6eaae9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GitHubTokenSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public static class GitHubTokenSource
{
public static string GetAccessToken()
{
var tokenFilePath = Path.Combine(GetCurrentScriptDirectory(), ".githubtoken");
var token = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
if (string.IsNullOrEmpty(token))
{
var tokenFilePath = Path.Combine(GetCurrentScriptDirectory(), ".githubtoken");
if (File.Exists(tokenFilePath))
{
token = File.ReadAllText(tokenFilePath)?.Trim();
Expand All @@ -21,7 +21,7 @@ public static string GetAccessToken()

if (string.IsNullOrEmpty(token))
{
throw new Exception("GitHub access token is missing; please put it in tools/.githubtoken, or in the GITHUB_TOKEN environment variable.");
throw new Exception($"GitHub access token is missing; please put it in '{tokenFilePath}', or in the GITHUB_TOKEN environment variable.");
}

return token;
Expand Down

0 comments on commit f6eaae9

Please sign in to comment.