mirror of
https://github.com/actions/stale.git
synced 2025-12-10 20:21:20 +00:00
fix dependencies
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user