Skip to content
Permalink
Browse files

19: Allow GitHub bots to use a PAT for authentication as well

Reviewed-by: ehelin
  • Loading branch information
Robin Westberg
Robin Westberg committed Jun 27, 2019
1 parent a185823 commit 561d7152a6b3c4bdab65ac327f4957c63c26e6a8
Showing with 9 additions and 4 deletions.
  1. +9 −4 bot/src/main/java/org/openjdk/skara/bot/BotRunnerConfiguration.java
@@ -78,10 +78,15 @@ private BotRunnerConfiguration(JSONObject config, Path cwd) throws Configuration
webUriReplacement = github.get("weburl").get("replacement").asString();
}

var keyFile = cwd.resolve(github.get("app").get("key").asString());
ret.put(entry.name(), HostFactory.createGitHubHost(uri, webUriPattern, webUriReplacement, keyFile.toString(),
github.get("app").get("id").asString(),
github.get("app").get("installation").asString()));
if (github.contains("app")) {
var keyFile = cwd.resolve(github.get("app").get("key").asString());
ret.put(entry.name(), HostFactory.createGitHubHost(uri, webUriPattern, webUriReplacement, keyFile.toString(),
github.get("app").get("id").asString(),
github.get("app").get("installation").asString()));
} else {
var pat = new PersonalAccessToken(github.get("username").asString(), github.get("pat").asString());
ret.put(entry.name(), HostFactory.createGitHubHost(uri, pat));
}
} else {
throw new ConfigurationError("Host " + entry.name());
}

0 comments on commit 561d715

Please sign in to comment.
You can’t perform that action at this time.