Use a single Octokit client for everything rather than a bunch of Octokits and an HTTP client.

This commit is contained in:
Chris Gavin 2020-06-23 19:08:30 +01:00
parent bc21c8f6f3
commit 74c48f71fa
No known key found for this signature in database
GPG key ID: 07F950B80C27E4DA
9 changed files with 92 additions and 91 deletions

11
src/api-client.ts Normal file
View file

@ -0,0 +1,11 @@
import * as core from "@actions/core";
import * as octokit from "@octokit/rest";
import consoleLogLevel from "console-log-level";
const githubAPIURL = process.env["GITHUB_API_URL"] || "https://api.github.com";
export const client = new octokit.Octokit({
auth: core.getInput("token"),
baseUrl: githubAPIURL,
userAgent: "CodeQL Action",
log: consoleLogLevel({ level: "debug" })
});