mirror of
https://github.com/github/codeql-action.git
synced 2026-10-30 01:27:22 +00:00
Capture rate limit and ref not existing config errors
This commit is contained in:
@@ -5,10 +5,12 @@ import consoleLogLevel from "console-log-level";
|
||||
|
||||
import { getActionVersion, getRequiredInput } from "./actions-util";
|
||||
import {
|
||||
ConfigurationError,
|
||||
getRequiredEnvParam,
|
||||
GITHUB_DOTCOM_URL,
|
||||
GitHubVariant,
|
||||
GitHubVersion,
|
||||
isHTTPError,
|
||||
parseGitHubUrl,
|
||||
parseMatrixInput,
|
||||
} from "./util";
|
||||
@@ -192,3 +194,15 @@ export function computeAutomationID(
|
||||
|
||||
return automationID;
|
||||
}
|
||||
|
||||
export function wrapApiConfigurationError(e: unknown) {
|
||||
if (isHTTPError(e)) {
|
||||
if (
|
||||
e.message.includes("API rate limit exceeded for site ID installation") ||
|
||||
/^ref .* not found in this repository$/.test(e.message)
|
||||
) {
|
||||
return new ConfigurationError(e.message);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as jsonschema from "jsonschema";
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { getOptionalInput, getRequiredInput } from "./actions-util";
|
||||
import * as api from "./api-client";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { getGitHubVersion, wrapApiConfigurationError } from "./api-client";
|
||||
import { CodeQL, getCodeQL } from "./codeql";
|
||||
import { getConfig } from "./config-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
@@ -256,7 +256,7 @@ async function uploadPayload(
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
throw wrapApiConfigurationError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user