Add unit tests for post: hook run methods
This commit is contained in:
parent
15608ceae3
commit
26cafd2f92
20 changed files with 426 additions and 91 deletions
|
|
@ -7,39 +7,12 @@
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { getConfig } from "./config-utils";
|
||||
import * as debugArtifacts from "./debug-artifacts";
|
||||
import { getActionsLogger } from "./logging";
|
||||
|
||||
async function run(
|
||||
uploadDatabaseBundleDebugArtifact: Function,
|
||||
uploadLogsDebugArtifact: Function,
|
||||
printDebugLogs: Function
|
||||
) {
|
||||
const logger = getActionsLogger();
|
||||
|
||||
const config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
|
||||
if (config === undefined) {
|
||||
throw new Error(
|
||||
"Config file could not be found at expected location. Did the 'init' action fail to start?"
|
||||
);
|
||||
}
|
||||
|
||||
// Upload appropriate Actions artifacts for debugging
|
||||
if (config?.debugMode) {
|
||||
core.info(
|
||||
"Debug mode is on. Uploading available database bundles and logs as Actions debugging artifacts..."
|
||||
);
|
||||
await uploadDatabaseBundleDebugArtifact(config, logger);
|
||||
await uploadLogsDebugArtifact(config);
|
||||
|
||||
await printDebugLogs(config);
|
||||
}
|
||||
}
|
||||
import * as initActionPostHelper from "./init-action-post-helper";
|
||||
|
||||
async function runWrapper() {
|
||||
try {
|
||||
await run(
|
||||
await initActionPostHelper.run(
|
||||
debugArtifacts.uploadDatabaseBundleDebugArtifact,
|
||||
debugArtifacts.uploadLogsDebugArtifact,
|
||||
actionsUtil.printDebugLogs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue