feat: add support for specifying the max number for retries to fetch missing history (#2052)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
5bd333239b
commit
07c64e5618
@ -227,6 +227,10 @@ inputs:
|
|||||||
description: "Exclude changes to submodules."
|
description: "Exclude changes to submodules."
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
fetch_missing_history_max_retries:
|
||||||
|
description: "Maximum number of retries to fetch missing history."
|
||||||
|
required: false
|
||||||
|
default: "10"
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
added_files:
|
added_files:
|
||||||
|
9
dist/index.js
generated
vendored
9
dist/index.js
generated
vendored
@ -1263,7 +1263,7 @@ const getSHAForPullRequestEvent = (_o) => __awaiter(void 0, [_o], void 0, functi
|
|||||||
diff
|
diff
|
||||||
}))) {
|
}))) {
|
||||||
core.info('Merge base is not in the local history, fetching remote target branch...');
|
core.info('Merge base is not in the local history, fetching remote target branch...');
|
||||||
for (let i = 1; i <= 10; i++) {
|
for (let i = 1; i <= (inputs.fetchMissingHistoryMaxRetries || 10); i++) {
|
||||||
yield (0, utils_1.gitFetch)({
|
yield (0, utils_1.gitFetch)({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
@ -1375,7 +1375,8 @@ exports.DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS = {
|
|||||||
skipInitialFetch: false,
|
skipInitialFetch: false,
|
||||||
fetchAdditionalSubmoduleHistory: false,
|
fetchAdditionalSubmoduleHistory: false,
|
||||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
||||||
excludeSubmodules: false
|
excludeSubmodules: false,
|
||||||
|
fetchMissingHistoryMaxRetries: 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1593,6 +1594,7 @@ const getInputs = () => {
|
|||||||
const excludeSubmodules = core.getBooleanInput('exclude_submodules', {
|
const excludeSubmodules = core.getBooleanInput('exclude_submodules', {
|
||||||
required: false
|
required: false
|
||||||
});
|
});
|
||||||
|
const fetchMissingHistoryMaxRetries = core.getInput('fetch_missing_history_max_retries', { required: false });
|
||||||
const inputs = {
|
const inputs = {
|
||||||
files,
|
files,
|
||||||
filesSeparator,
|
filesSeparator,
|
||||||
@ -1656,6 +1658,9 @@ const getInputs = () => {
|
|||||||
if (dirNamesMaxDepth) {
|
if (dirNamesMaxDepth) {
|
||||||
inputs.dirNamesMaxDepth = parseInt(dirNamesMaxDepth, 10);
|
inputs.dirNamesMaxDepth = parseInt(dirNamesMaxDepth, 10);
|
||||||
}
|
}
|
||||||
|
if (fetchMissingHistoryMaxRetries) {
|
||||||
|
inputs.fetchMissingHistoryMaxRetries = parseInt(fetchMissingHistoryMaxRetries, 10);
|
||||||
|
}
|
||||||
return inputs;
|
return inputs;
|
||||||
};
|
};
|
||||||
exports.getInputs = getInputs;
|
exports.getInputs = getInputs;
|
||||||
|
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
@ -15,6 +15,7 @@ exports[`getInputs should correctly parse boolean inputs 1`] = `
|
|||||||
"failOnInitialDiffError": "false",
|
"failOnInitialDiffError": "false",
|
||||||
"failOnSubmoduleDiffError": "false",
|
"failOnSubmoduleDiffError": "false",
|
||||||
"fetchAdditionalSubmoduleHistory": "false",
|
"fetchAdditionalSubmoduleHistory": "false",
|
||||||
|
"fetchMissingHistoryMaxRetries": 10,
|
||||||
"files": "",
|
"files": "",
|
||||||
"filesFromSourceFile": "",
|
"filesFromSourceFile": "",
|
||||||
"filesFromSourceFileSeparator": "",
|
"filesFromSourceFileSeparator": "",
|
||||||
@ -308,6 +309,7 @@ exports[`getInputs should return default values when no inputs are provided 1`]
|
|||||||
"failOnInitialDiffError": false,
|
"failOnInitialDiffError": false,
|
||||||
"failOnSubmoduleDiffError": false,
|
"failOnSubmoduleDiffError": false,
|
||||||
"fetchAdditionalSubmoduleHistory": false,
|
"fetchAdditionalSubmoduleHistory": false,
|
||||||
|
"fetchMissingHistoryMaxRetries": 10,
|
||||||
"files": "",
|
"files": "",
|
||||||
"filesFromSourceFile": "",
|
"filesFromSourceFile": "",
|
||||||
"filesFromSourceFileSeparator": "",
|
"filesFromSourceFileSeparator": "",
|
||||||
|
@ -636,7 +636,8 @@ describe('utils test', () => {
|
|||||||
failOnSubmoduleDiffError: false,
|
failOnSubmoduleDiffError: false,
|
||||||
negationPatternsFirst: false,
|
negationPatternsFirst: false,
|
||||||
useRestApi: false,
|
useRestApi: false,
|
||||||
excludeSubmodules: false
|
excludeSubmodules: false,
|
||||||
|
fetchMissingHistoryMaxRetries: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
const coreWarningSpy = jest.spyOn(core, 'warning')
|
const coreWarningSpy = jest.spyOn(core, 'warning')
|
||||||
|
@ -528,7 +528,11 @@ export const getSHAForPullRequestEvent = async ({
|
|||||||
'Merge base is not in the local history, fetching remote target branch...'
|
'Merge base is not in the local history, fetching remote target branch...'
|
||||||
)
|
)
|
||||||
|
|
||||||
for (let i = 1; i <= 10; i++) {
|
for (
|
||||||
|
let i = 1;
|
||||||
|
i <= (inputs.fetchMissingHistoryMaxRetries || 10);
|
||||||
|
i++
|
||||||
|
) {
|
||||||
await gitFetch({
|
await gitFetch({
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
args: [
|
args: [
|
||||||
|
@ -21,5 +21,6 @@ export const DEFAULT_VALUES_OF_UNSUPPORTED_API_INPUTS: Partial<Inputs> = {
|
|||||||
skipInitialFetch: false,
|
skipInitialFetch: false,
|
||||||
fetchAdditionalSubmoduleHistory: false,
|
fetchAdditionalSubmoduleHistory: false,
|
||||||
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
dirNamesDeletedFilesIncludeOnlyDeletedDirs: false,
|
||||||
excludeSubmodules: false
|
excludeSubmodules: false,
|
||||||
|
fetchMissingHistoryMaxRetries: 10
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ export type Inputs = {
|
|||||||
negationPatternsFirst: boolean
|
negationPatternsFirst: boolean
|
||||||
useRestApi: boolean
|
useRestApi: boolean
|
||||||
excludeSubmodules: boolean
|
excludeSubmodules: boolean
|
||||||
|
fetchMissingHistoryMaxRetries?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getInputs = (): Inputs => {
|
export const getInputs = (): Inputs => {
|
||||||
@ -245,6 +246,11 @@ export const getInputs = (): Inputs => {
|
|||||||
required: false
|
required: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const fetchMissingHistoryMaxRetries = core.getInput(
|
||||||
|
'fetch_missing_history_max_retries',
|
||||||
|
{required: false}
|
||||||
|
)
|
||||||
|
|
||||||
const inputs: Inputs = {
|
const inputs: Inputs = {
|
||||||
files,
|
files,
|
||||||
filesSeparator,
|
filesSeparator,
|
||||||
@ -311,5 +317,12 @@ export const getInputs = (): Inputs => {
|
|||||||
inputs.dirNamesMaxDepth = parseInt(dirNamesMaxDepth, 10)
|
inputs.dirNamesMaxDepth = parseInt(dirNamesMaxDepth, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fetchMissingHistoryMaxRetries) {
|
||||||
|
inputs.fetchMissingHistoryMaxRetries = parseInt(
|
||||||
|
fetchMissingHistoryMaxRetries,
|
||||||
|
10
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return inputs
|
return inputs
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user