3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-20 21:01:53 +00:00

chore: rename git fetch arguments (#1259)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack 2023-06-14 13:22:47 -06:00 committed by GitHub
parent 174a2a6360
commit b9ea510e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 29 deletions

28
dist/index.js generated vendored
View file

@ -272,7 +272,7 @@ const getCurrentSHA = ({ env, inputs, workingDirectory }) => __awaiter(void 0, v
core.debug(`Current SHA: ${currentSha}`);
return currentSha;
});
const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitExtraArgs, isTag) => __awaiter(void 0, void 0, void 0, function* () {
const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, isTag) => __awaiter(void 0, void 0, void 0, function* () {
let targetBranch = env.GITHUB_REF_NAME;
const currentBranch = targetBranch;
let initialCommit = false;
@ -284,7 +284,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -297,7 +297,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -310,7 +310,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
yield (0, utils_1.gitFetchSubmodules)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
@ -414,7 +414,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
};
});
exports.getSHAForPushEvent = getSHAForPushEvent;
const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitExtraArgs) => __awaiter(void 0, void 0, void 0, function* () {
const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs) => __awaiter(void 0, void 0, void 0, function* () {
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF;
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF;
if (inputs.sinceLastRemoteCommit) {
@ -425,7 +425,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
let prFetchExitCode = yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
'origin',
@ -436,7 +436,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
prFetchExitCode = yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -453,7 +453,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -465,7 +465,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
yield (0, utils_1.gitFetchSubmodules)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
@ -534,7 +534,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
yield (0, utils_1.gitFetch)({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -893,23 +893,23 @@ function run() {
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 gitExtraArgs = ['--no-tags', '--prune', '--recurse-submodules'];
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules'];
const isTag = (_a = env.GITHUB_REF) === null || _a === void 0 ? void 0 : _a.startsWith('refs/tags/');
let submodulePaths = [];
if (hasSubmodule) {
submodulePaths = yield (0, utils_1.getSubmodulePath)({ cwd: workingDirectory });
}
if (isTag) {
gitExtraArgs = ['--prune', '--no-recurse-submodules'];
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules'];
}
let diffResult;
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'push'} event...`);
diffResult = yield (0, commitSha_1.getSHAForPushEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitExtraArgs, isTag);
diffResult = yield (0, commitSha_1.getSHAForPushEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs, isTag);
}
else {
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'pull_request'} event...`);
diffResult = yield (0, commitSha_1.getSHAForPullRequestEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitExtraArgs);
diffResult = yield (0, commitSha_1.getSHAForPullRequestEvent)(inputs, env, workingDirectory, isShallow, hasSubmodule, gitFetchExtraArgs);
}
if (diffResult.initialCommit) {
core.info('This is the first commit for this repository; exiting...');

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -85,7 +85,7 @@ export const getSHAForPushEvent = async (
workingDirectory: string,
isShallow: boolean,
hasSubmodule: boolean,
gitExtraArgs: string[],
gitFetchExtraArgs: string[],
isTag: boolean
): Promise<DiffResult> => {
let targetBranch = env.GITHUB_REF_NAME
@ -102,7 +102,7 @@ export const getSHAForPushEvent = async (
await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -114,7 +114,7 @@ export const getSHAForPushEvent = async (
await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -128,7 +128,7 @@ export const getSHAForPushEvent = async (
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
@ -263,7 +263,7 @@ export const getSHAForPullRequestEvent = async (
workingDirectory: string,
isShallow: boolean,
hasSubmodule: boolean,
gitExtraArgs: string[]
gitFetchExtraArgs: string[]
): Promise<DiffResult> => {
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF
@ -277,7 +277,7 @@ export const getSHAForPullRequestEvent = async (
let prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
'origin',
@ -289,7 +289,7 @@ export const getSHAForPullRequestEvent = async (
prFetchExitCode = await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -310,7 +310,7 @@ export const getSHAForPullRequestEvent = async (
await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
@ -323,7 +323,7 @@ export const getSHAForPullRequestEvent = async (
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
@ -415,7 +415,7 @@ export const getSHAForPullRequestEvent = async (
await gitFetch({
cwd: workingDirectory,
args: [
...gitExtraArgs,
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,

View file

@ -59,7 +59,7 @@ export async function run(): Promise<void> {
)
const isShallow = await isRepoShallow({cwd: workingDirectory})
const hasSubmodule = await submoduleExists({cwd: workingDirectory})
let gitExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
const isTag = env.GITHUB_REF?.startsWith('refs/tags/')
let submodulePaths: string[] = []
@ -68,7 +68,7 @@ export async function run(): Promise<void> {
}
if (isTag) {
gitExtraArgs = ['--prune', '--no-recurse-submodules']
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules']
}
let diffResult: DiffResult
@ -81,7 +81,7 @@ export async function run(): Promise<void> {
workingDirectory,
isShallow,
hasSubmodule,
gitExtraArgs,
gitFetchExtraArgs,
isTag
)
} else {
@ -94,7 +94,7 @@ export async function run(): Promise<void> {
workingDirectory,
isShallow,
hasSubmodule,
gitExtraArgs
gitFetchExtraArgs
)
}