mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Add getErrorMessage to pr-checks-local util.ts to avoid pulling in src/util.ts dependencies
This commit is contained in:
@@ -6,14 +6,13 @@
|
|||||||
|
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
import { getErrorMessage } from "../src/util";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
parseChangelog,
|
parseChangelog,
|
||||||
renderChangelog,
|
renderChangelog,
|
||||||
UNRELEASED_PLACEHOLDER,
|
UNRELEASED_PLACEHOLDER,
|
||||||
} from "./changelog";
|
} from "./changelog";
|
||||||
import { CHANGELOG_FILE, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config";
|
import { CHANGELOG_FILE, CLI_BUNDLE_RELEASE_URL_PREFIX } from "./config";
|
||||||
|
import { getErrorMessage } from "./util";
|
||||||
|
|
||||||
export const CLI_VERSION_ENV_VAR = "CLI_VERSION";
|
export const CLI_VERSION_ENV_VAR = "CLI_VERSION";
|
||||||
export const PR_URL_ENV_VAR = "PR_URL";
|
export const PR_URL_ENV_VAR = "PR_URL";
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
import { parseArgs } from "node:util";
|
import { parseArgs } from "node:util";
|
||||||
|
|
||||||
import { getErrorMessage } from "../src/util";
|
|
||||||
|
|
||||||
import { NO_CHANGES_STR, parseChangelog } from "./changelog";
|
import { NO_CHANGES_STR, parseChangelog } from "./changelog";
|
||||||
import { CHANGELOG_FILE } from "./config";
|
import { CHANGELOG_FILE } from "./config";
|
||||||
|
import { getErrorMessage } from "./util";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare the changelog for the new release
|
* Prepare the changelog for the new release
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
import { parseArgs } from "node:util";
|
import { parseArgs } from "node:util";
|
||||||
|
|
||||||
import { getErrorMessage } from "../src/util";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Changelog,
|
Changelog,
|
||||||
ChangelogSection,
|
ChangelogSection,
|
||||||
@@ -17,6 +15,7 @@ import {
|
|||||||
renderChangelog,
|
renderChangelog,
|
||||||
} from "./changelog";
|
} from "./changelog";
|
||||||
import { CHANGELOG_FILE } from "./config";
|
import { CHANGELOG_FILE } from "./config";
|
||||||
|
import { getErrorMessage } from "./util";
|
||||||
|
|
||||||
export interface RollbackChangelogInputs {
|
export interface RollbackChangelogInputs {
|
||||||
"target-version": string;
|
"target-version": string;
|
||||||
|
|||||||
9
pr-checks/util.ts
Normal file
9
pr-checks/util.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Returns an appropriate message for the error.
|
||||||
|
*
|
||||||
|
* If the error is an `Error` instance, this returns the error message without
|
||||||
|
* an `Error: ` prefix.
|
||||||
|
*/
|
||||||
|
export function getErrorMessage(error: unknown): string {
|
||||||
|
return error instanceof Error ? error.message : String(error);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user