Running lint-fix

This commit is contained in:
Chris Raynor 2020-09-14 10:44:43 +01:00
parent c96f84308a
commit a184d50a26
No known key found for this signature in database
GPG key ID: 579A1FBC36FDA261
89 changed files with 3646 additions and 2809 deletions

View file

@ -1,21 +1,24 @@
import * as core from "@actions/core";
import * as github from "@actions/github";
import consoleLogLevel from "console-log-level";
import * as path from 'path';
import * as path from "path";
import { getRequiredEnvParam, isLocalRun } from "./util";
export const getApiClient = function(githubAuth: string, githubUrl: string, allowLocalRun = false) {
export const getApiClient = function (
githubAuth: string,
githubUrl: string,
allowLocalRun = false
) {
if (isLocalRun() && !allowLocalRun) {
throw new Error('Invalid API call in local run');
throw new Error("Invalid API call in local run");
}
return new github.GitHub(
{
auth: githubAuth,
baseUrl: getApiUrl(githubUrl),
userAgent: "CodeQL Action",
log: consoleLogLevel({ level: "debug" })
});
return new github.GitHub({
auth: githubAuth,
baseUrl: getApiUrl(githubUrl),
userAgent: "CodeQL Action",
log: consoleLogLevel({ level: "debug" }),
});
};
function getApiUrl(githubUrl: string): string {
@ -23,12 +26,12 @@ function getApiUrl(githubUrl: string): string {
// If we detect this is trying to be to github.com
// then return with a fixed canonical URL.
if (url.hostname === 'github.com' || url.hostname === 'api.github.com') {
return 'https://api.github.com';
if (url.hostname === "github.com" || url.hostname === "api.github.com") {
return "https://api.github.com";
}
// Add the /api/v3 API prefix
url.pathname = path.join(url.pathname, 'api', 'v3');
url.pathname = path.join(url.pathname, "api", "v3");
return url.toString();
}
@ -37,7 +40,8 @@ function getApiUrl(githubUrl: string): string {
// and called only from the action entrypoints.
export function getActionsApiClient(allowLocalRun = false) {
return getApiClient(
core.getInput('token'),
getRequiredEnvParam('GITHUB_SERVER_URL'),
allowLocalRun);
core.getInput("token"),
getRequiredEnvParam("GITHUB_SERVER_URL"),
allowLocalRun
);
}