fix dependencies

This commit is contained in:
Sergey Dolin
2023-07-05 17:03:52 +02:00
parent 6ed4ef197b
commit a5472823b9
5 changed files with 2 additions and 62 deletions

View File

@@ -3,7 +3,6 @@ import fs from 'fs';
import path from 'path';
import os from 'os';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {getOctokit} from '@actions/github';
import {retry as octokitRetry} from '@octokit/plugin-retry';
import * as cache from '@actions/cache';
@@ -26,37 +25,6 @@ const unlinkSafely = (filePath: string) => {
}
};
export const getCommandOutput = async (
toolCommand: string,
cwd?: string
): Promise<string> => {
let {stdout, stderr, exitCode} = await exec.getExecOutput(
toolCommand,
undefined,
{ignoreReturnCode: true, ...(cwd && {cwd})}
);
if (exitCode) {
stderr = !stderr.trim()
? `The '${toolCommand}' command failed with exit code: ${exitCode}`
: stderr;
throw new Error(stderr);
}
return stdout.trim();
};
async function execCommands(commands: string[], cwd?: string): Promise<void> {
for (const command of commands) {
try {
await exec.exec(command, undefined, {cwd});
} catch (error) {
throw new Error(
`${command.split(' ')[0]} failed with error: ${error?.message}`
);
}
}
}
const resetCacheWithOctokit = async (cacheKey: string): Promise<void> => {
const token = core.getInput('repo-token');
const client = getOctokit(token, undefined, octokitRetry);

View File

@@ -121,7 +121,7 @@ describe('State', () => {
expect(processedIssuesIDs).toEqual(new Set([1, 2, 3]));
expect(infoSpy).toHaveBeenCalledTimes(1);
expect(infoSpy).toHaveBeenCalledWith(
'state: rehydrated with info about 3 issue(s)'
'state: restored with info about 3 issue(s)'
);
});
});