chore: rename git fetch arguments (#1259)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
174a2a6360
commit
b9ea510e42
28
dist/index.js
generated
vendored
28
dist/index.js
generated
vendored
@ -272,7 +272,7 @@ const getCurrentSHA = ({ env, inputs, workingDirectory }) => __awaiter(void 0, v
|
|||||||
core.debug(`Current SHA: ${currentSha}`);
|
core.debug(`Current SHA: ${currentSha}`);
|
||||||
return 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;
|
let targetBranch = env.GITHUB_REF_NAME;
|
||||||
const currentBranch = targetBranch;
|
const currentBranch = targetBranch;
|
||||||
let initialCommit = false;
|
let initialCommit = false;
|
||||||
@ -284,7 +284,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
|
|||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -297,7 +297,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
|
|||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -310,7 +310,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
|
|||||||
yield (0, utils_1.gitFetchSubmodules)({
|
yield (0, utils_1.gitFetchSubmodules)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`
|
`--deepen=${inputs.fetchDepth}`
|
||||||
@ -414,7 +414,7 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
exports.getSHAForPushEvent = getSHAForPushEvent;
|
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;
|
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF;
|
||||||
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF;
|
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF;
|
||||||
if (inputs.sinceLastRemoteCommit) {
|
if (inputs.sinceLastRemoteCommit) {
|
||||||
@ -425,7 +425,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||||||
let prFetchExitCode = yield (0, utils_1.gitFetch)({
|
let prFetchExitCode = yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
'origin',
|
'origin',
|
||||||
@ -436,7 +436,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||||||
prFetchExitCode = yield (0, utils_1.gitFetch)({
|
prFetchExitCode = yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -453,7 +453,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -465,7 +465,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||||||
yield (0, utils_1.gitFetchSubmodules)({
|
yield (0, utils_1.gitFetchSubmodules)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`
|
`--deepen=${inputs.fetchDepth}`
|
||||||
@ -534,7 +534,7 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -893,23 +893,23 @@ function run() {
|
|||||||
const workingDirectory = path_1.default.resolve(env.GITHUB_WORKSPACE || process.cwd(), inputs.path);
|
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 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/');
|
const isTag = (_a = env.GITHUB_REF) === null || _a === void 0 ? void 0 : _a.startsWith('refs/tags/');
|
||||||
let submodulePaths = [];
|
let submodulePaths = [];
|
||||||
if (hasSubmodule) {
|
if (hasSubmodule) {
|
||||||
submodulePaths = yield (0, utils_1.getSubmodulePath)({ cwd: workingDirectory });
|
submodulePaths = yield (0, utils_1.getSubmodulePath)({ cwd: workingDirectory });
|
||||||
}
|
}
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
gitExtraArgs = ['--prune', '--no-recurse-submodules'];
|
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules'];
|
||||||
}
|
}
|
||||||
let diffResult;
|
let diffResult;
|
||||||
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
|
if (!env.GITHUB_EVENT_PULL_REQUEST_BASE_REF) {
|
||||||
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'push'} event...`);
|
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 {
|
else {
|
||||||
core.info(`Running on a ${env.GITHUB_EVENT_NAME || 'pull_request'} event...`);
|
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) {
|
if (diffResult.initialCommit) {
|
||||||
core.info('This is the first commit for this repository; exiting...');
|
core.info('This is the first commit for this repository; exiting...');
|
||||||
|
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
@ -85,7 +85,7 @@ export const getSHAForPushEvent = async (
|
|||||||
workingDirectory: string,
|
workingDirectory: string,
|
||||||
isShallow: boolean,
|
isShallow: boolean,
|
||||||
hasSubmodule: boolean,
|
hasSubmodule: boolean,
|
||||||
gitExtraArgs: string[],
|
gitFetchExtraArgs: string[],
|
||||||
isTag: boolean
|
isTag: boolean
|
||||||
): Promise<DiffResult> => {
|
): Promise<DiffResult> => {
|
||||||
let targetBranch = env.GITHUB_REF_NAME
|
let targetBranch = env.GITHUB_REF_NAME
|
||||||
@ -102,7 +102,7 @@ export const getSHAForPushEvent = async (
|
|||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -114,7 +114,7 @@ export const getSHAForPushEvent = async (
|
|||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -128,7 +128,7 @@ export const getSHAForPushEvent = async (
|
|||||||
await gitFetchSubmodules({
|
await gitFetchSubmodules({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`
|
`--deepen=${inputs.fetchDepth}`
|
||||||
@ -263,7 +263,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
workingDirectory: string,
|
workingDirectory: string,
|
||||||
isShallow: boolean,
|
isShallow: boolean,
|
||||||
hasSubmodule: boolean,
|
hasSubmodule: boolean,
|
||||||
gitExtraArgs: string[]
|
gitFetchExtraArgs: string[]
|
||||||
): Promise<DiffResult> => {
|
): Promise<DiffResult> => {
|
||||||
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF
|
let targetBranch = env.GITHUB_EVENT_PULL_REQUEST_BASE_REF
|
||||||
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF
|
const currentBranch = env.GITHUB_EVENT_PULL_REQUEST_HEAD_REF
|
||||||
@ -277,7 +277,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
let prFetchExitCode = await gitFetch({
|
let prFetchExitCode = await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
'origin',
|
'origin',
|
||||||
@ -289,7 +289,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
prFetchExitCode = await gitFetch({
|
prFetchExitCode = await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -310,7 +310,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
@ -323,7 +323,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
await gitFetchSubmodules({
|
await gitFetchSubmodules({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`
|
`--deepen=${inputs.fetchDepth}`
|
||||||
@ -415,7 +415,7 @@ export const getSHAForPullRequestEvent = async (
|
|||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
...gitExtraArgs,
|
...gitFetchExtraArgs,
|
||||||
'-u',
|
'-u',
|
||||||
'--progress',
|
'--progress',
|
||||||
`--deepen=${inputs.fetchDepth}`,
|
`--deepen=${inputs.fetchDepth}`,
|
||||||
|
@ -59,7 +59,7 @@ export async function run(): Promise<void> {
|
|||||||
)
|
)
|
||||||
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 gitExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
|
let gitFetchExtraArgs = ['--no-tags', '--prune', '--recurse-submodules']
|
||||||
const isTag = env.GITHUB_REF?.startsWith('refs/tags/')
|
const isTag = env.GITHUB_REF?.startsWith('refs/tags/')
|
||||||
let submodulePaths: string[] = []
|
let submodulePaths: string[] = []
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ export async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
gitExtraArgs = ['--prune', '--no-recurse-submodules']
|
gitFetchExtraArgs = ['--prune', '--no-recurse-submodules']
|
||||||
}
|
}
|
||||||
|
|
||||||
let diffResult: DiffResult
|
let diffResult: DiffResult
|
||||||
@ -81,7 +81,7 @@ export async function run(): Promise<void> {
|
|||||||
workingDirectory,
|
workingDirectory,
|
||||||
isShallow,
|
isShallow,
|
||||||
hasSubmodule,
|
hasSubmodule,
|
||||||
gitExtraArgs,
|
gitFetchExtraArgs,
|
||||||
isTag
|
isTag
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -94,7 +94,7 @@ export async function run(): Promise<void> {
|
|||||||
workingDirectory,
|
workingDirectory,
|
||||||
isShallow,
|
isShallow,
|
||||||
hasSubmodule,
|
hasSubmodule,
|
||||||
gitExtraArgs
|
gitFetchExtraArgs
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user