Fixed the test

This commit is contained in:
Tonye Jack 2023-06-22 19:40:00 -06:00
parent 2eb11f64a4
commit ca880f4339
3 changed files with 20 additions and 26 deletions

15
dist/index.js generated vendored
View File

@ -1338,7 +1338,7 @@ const commitSha_1 = __nccwpck_require__(8613);
const env_1 = __nccwpck_require__(9763);
const inputs_1 = __nccwpck_require__(6180);
const utils_1 = __nccwpck_require__(918);
const getChangedFilesFromLocalGit = ({ inputs, env }) => __awaiter(void 0, void 0, void 0, function* () {
const getChangedFilesFromLocalGit = ({ inputs, env, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
yield (0, utils_1.verifyMinimumGitVersion)();
let quotePathValue = 'on';
@ -1355,7 +1355,6 @@ const getChangedFilesFromLocalGit = ({ inputs, env }) => __awaiter(void 0, void
value: 'true'
});
}
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
const isShallow = yield (0, utils_1.isRepoShallow)({ cwd: workingDirectory });
const hasSubmodule = yield (0, utils_1.submoduleExists)({ cwd: workingDirectory });
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules'];
@ -1465,8 +1464,7 @@ const getChangedFilesFromLocalGit = ({ inputs, env }) => __awaiter(void 0, void
core.endGroup();
}
});
const getChangedFilesFromRESTAPI = ({ inputs, env }) => __awaiter(void 0, void 0, void 0, function* () {
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
const getChangedFilesFromRESTAPI = ({ inputs, env, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
const allDiffFiles = yield (0, changedFiles_1.getChangedFilesFromGithubAPI)({
inputs,
env
@ -1526,9 +1524,8 @@ function run() {
core.debug(`Env: ${JSON.stringify(env, null, 2)}`);
const inputs = (0, inputs_1.getInputs)();
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({
workingDirectory: env.GITHUB_WORKSPACE || process.cwd()
});
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({ workingDirectory });
if (inputs.token &&
env.GITHUB_EVENT_PULL_REQUEST_NUMBER &&
!hasGitDirectory) {
@ -1553,11 +1550,11 @@ function run() {
core.warning(`Input "${input}" is not supported via REST API`);
}
}
yield getChangedFilesFromRESTAPI({ inputs, env });
yield getChangedFilesFromRESTAPI({ inputs, env, workingDirectory });
}
else {
core.info('Running via local git');
yield getChangedFilesFromLocalGit({ inputs, env });
yield getChangedFilesFromLocalGit({ inputs, env, workingDirectory });
}
});
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -27,10 +27,12 @@ import {
const getChangedFilesFromLocalGit = async ({
inputs,
env
env,
workingDirectory
}: {
inputs: Inputs
env: Env
workingDirectory: string
}): Promise<void> => {
await verifyMinimumGitVersion()
@ -52,10 +54,6 @@ const getChangedFilesFromLocalGit = async ({
})
}
const workingDirectory = path.resolve(
env.GITHUB_WORKSPACE || process.cwd(),
inputs.path
)
const isShallow = await isRepoShallow({cwd: workingDirectory})
const hasSubmodule = await submoduleExists({cwd: workingDirectory})
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
@ -202,16 +200,13 @@ const getChangedFilesFromLocalGit = async ({
const getChangedFilesFromRESTAPI = async ({
inputs,
env
env,
workingDirectory
}: {
inputs: Inputs
env: Env
workingDirectory: string
}): Promise<void> => {
const workingDirectory = path.resolve(
env.GITHUB_WORKSPACE || process.cwd(),
inputs.path
)
const allDiffFiles = await getChangedFilesFromGithubAPI({
inputs,
env
@ -277,9 +272,11 @@ export async function run(): Promise<void> {
core.debug(`Env: ${JSON.stringify(env, null, 2)}`)
const inputs = getInputs()
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`)
const hasGitDirectory = await hasLocalGitDirectory({
workingDirectory: env.GITHUB_WORKSPACE || process.cwd()
})
const workingDirectory = path.resolve(
env.GITHUB_WORKSPACE || process.cwd(),
inputs.path
)
const hasGitDirectory = await hasLocalGitDirectory({workingDirectory})
if (
inputs.token &&
@ -308,10 +305,10 @@ export async function run(): Promise<void> {
core.warning(`Input "${input}" is not supported via REST API`)
}
}
await getChangedFilesFromRESTAPI({inputs, env})
await getChangedFilesFromRESTAPI({inputs, env, workingDirectory})
} else {
core.info('Running via local git')
await getChangedFilesFromLocalGit({inputs, env})
await getChangedFilesFromLocalGit({inputs, env, workingDirectory})
}
}