Fixed the test
This commit is contained in:
parent
2eb11f64a4
commit
ca880f4339
15
dist/index.js
generated
vendored
15
dist/index.js
generated
vendored
@ -1338,7 +1338,7 @@ const commitSha_1 = __nccwpck_require__(8613);
|
|||||||
const env_1 = __nccwpck_require__(9763);
|
const env_1 = __nccwpck_require__(9763);
|
||||||
const inputs_1 = __nccwpck_require__(6180);
|
const inputs_1 = __nccwpck_require__(6180);
|
||||||
const utils_1 = __nccwpck_require__(918);
|
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;
|
var _a;
|
||||||
yield (0, utils_1.verifyMinimumGitVersion)();
|
yield (0, utils_1.verifyMinimumGitVersion)();
|
||||||
let quotePathValue = 'on';
|
let quotePathValue = 'on';
|
||||||
@ -1355,7 +1355,6 @@ const getChangedFilesFromLocalGit = ({ inputs, env }) => __awaiter(void 0, void
|
|||||||
value: 'true'
|
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 isShallow = yield (0, utils_1.isRepoShallow)({ cwd: workingDirectory });
|
||||||
const hasSubmodule = yield (0, utils_1.submoduleExists)({ cwd: workingDirectory });
|
const hasSubmodule = yield (0, utils_1.submoduleExists)({ cwd: workingDirectory });
|
||||||
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules'];
|
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules'];
|
||||||
@ -1465,8 +1464,7 @@ const getChangedFilesFromLocalGit = ({ inputs, env }) => __awaiter(void 0, void
|
|||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const getChangedFilesFromRESTAPI = ({ inputs, env }) => __awaiter(void 0, void 0, void 0, function* () {
|
const getChangedFilesFromRESTAPI = ({ inputs, env, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
|
|
||||||
const allDiffFiles = yield (0, changedFiles_1.getChangedFilesFromGithubAPI)({
|
const allDiffFiles = yield (0, changedFiles_1.getChangedFilesFromGithubAPI)({
|
||||||
inputs,
|
inputs,
|
||||||
env
|
env
|
||||||
@ -1526,9 +1524,8 @@ function run() {
|
|||||||
core.debug(`Env: ${JSON.stringify(env, null, 2)}`);
|
core.debug(`Env: ${JSON.stringify(env, null, 2)}`);
|
||||||
const inputs = (0, inputs_1.getInputs)();
|
const inputs = (0, inputs_1.getInputs)();
|
||||||
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
|
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`);
|
||||||
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({
|
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
|
||||||
workingDirectory: env.GITHUB_WORKSPACE || process.cwd()
|
const hasGitDirectory = yield (0, utils_1.hasLocalGitDirectory)({ workingDirectory });
|
||||||
});
|
|
||||||
if (inputs.token &&
|
if (inputs.token &&
|
||||||
env.GITHUB_EVENT_PULL_REQUEST_NUMBER &&
|
env.GITHUB_EVENT_PULL_REQUEST_NUMBER &&
|
||||||
!hasGitDirectory) {
|
!hasGitDirectory) {
|
||||||
@ -1553,11 +1550,11 @@ function run() {
|
|||||||
core.warning(`Input "${input}" is not supported via REST API`);
|
core.warning(`Input "${input}" is not supported via REST API`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yield getChangedFilesFromRESTAPI({ inputs, env });
|
yield getChangedFilesFromRESTAPI({ inputs, env, workingDirectory });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info('Running via local git');
|
core.info('Running via local git');
|
||||||
yield getChangedFilesFromLocalGit({ inputs, env });
|
yield getChangedFilesFromLocalGit({ inputs, env, workingDirectory });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
29
src/main.ts
29
src/main.ts
@ -27,10 +27,12 @@ import {
|
|||||||
|
|
||||||
const getChangedFilesFromLocalGit = async ({
|
const getChangedFilesFromLocalGit = async ({
|
||||||
inputs,
|
inputs,
|
||||||
env
|
env,
|
||||||
|
workingDirectory
|
||||||
}: {
|
}: {
|
||||||
inputs: Inputs
|
inputs: Inputs
|
||||||
env: Env
|
env: Env
|
||||||
|
workingDirectory: string
|
||||||
}): Promise<void> => {
|
}): Promise<void> => {
|
||||||
await verifyMinimumGitVersion()
|
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 isShallow = await isRepoShallow({cwd: workingDirectory})
|
||||||
const hasSubmodule = await submoduleExists({cwd: workingDirectory})
|
const hasSubmodule = await submoduleExists({cwd: workingDirectory})
|
||||||
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
|
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
|
||||||
@ -202,16 +200,13 @@ const getChangedFilesFromLocalGit = async ({
|
|||||||
|
|
||||||
const getChangedFilesFromRESTAPI = async ({
|
const getChangedFilesFromRESTAPI = async ({
|
||||||
inputs,
|
inputs,
|
||||||
env
|
env,
|
||||||
|
workingDirectory
|
||||||
}: {
|
}: {
|
||||||
inputs: Inputs
|
inputs: Inputs
|
||||||
env: Env
|
env: Env
|
||||||
|
workingDirectory: string
|
||||||
}): Promise<void> => {
|
}): Promise<void> => {
|
||||||
const workingDirectory = path.resolve(
|
|
||||||
env.GITHUB_WORKSPACE || process.cwd(),
|
|
||||||
inputs.path
|
|
||||||
)
|
|
||||||
|
|
||||||
const allDiffFiles = await getChangedFilesFromGithubAPI({
|
const allDiffFiles = await getChangedFilesFromGithubAPI({
|
||||||
inputs,
|
inputs,
|
||||||
env
|
env
|
||||||
@ -277,9 +272,11 @@ export async function run(): Promise<void> {
|
|||||||
core.debug(`Env: ${JSON.stringify(env, null, 2)}`)
|
core.debug(`Env: ${JSON.stringify(env, null, 2)}`)
|
||||||
const inputs = getInputs()
|
const inputs = getInputs()
|
||||||
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`)
|
core.debug(`Inputs: ${JSON.stringify(inputs, null, 2)}`)
|
||||||
const hasGitDirectory = await hasLocalGitDirectory({
|
const workingDirectory = path.resolve(
|
||||||
workingDirectory: env.GITHUB_WORKSPACE || process.cwd()
|
env.GITHUB_WORKSPACE || process.cwd(),
|
||||||
})
|
inputs.path
|
||||||
|
)
|
||||||
|
const hasGitDirectory = await hasLocalGitDirectory({workingDirectory})
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inputs.token &&
|
inputs.token &&
|
||||||
@ -308,10 +305,10 @@ export async function run(): Promise<void> {
|
|||||||
core.warning(`Input "${input}" is not supported via REST API`)
|
core.warning(`Input "${input}" is not supported via REST API`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await getChangedFilesFromRESTAPI({inputs, env})
|
await getChangedFilesFromRESTAPI({inputs, env, workingDirectory})
|
||||||
} else {
|
} else {
|
||||||
core.info('Running via local git')
|
core.info('Running via local git')
|
||||||
await getChangedFilesFromLocalGit({inputs, env})
|
await getChangedFilesFromLocalGit({inputs, env, workingDirectory})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user