@@ -1525,20 +1525,20 @@ function getSource(settings) {
15251525 }
15261526 if (settings.fetchDepth <= 0) {
15271527 let refSpec = settings.singleBranch
1528- ? refHelper.getRefSpec(settings.ref, settings.commit)
1528+ ? refHelper.getRefSpec(settings.ref, settings.commit, settings.additionalFetchRefs )
15291529 : refHelper.getRefSpecForAllHistory(settings.ref, settings.commit);
15301530 yield git.fetch(refSpec, fetchOptions);
15311531 // When all history is fetched, the ref we're interested in may have moved to a different
15321532 // commit (push or force push). If so, fetch again with a targeted refspec.
15331533 if (!(yield refHelper.testRef(git, settings.ref, settings.commit))) {
1534- refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
1534+ refSpec = refHelper.getRefSpec(settings.ref, settings.commit, settings.additionalFetchRefs );
15351535 yield git.fetch(refSpec, fetchOptions);
15361536 }
15371537 }
15381538 else {
15391539 fetchOptions.fetchDepth = settings.fetchDepth;
15401540 fetchOptions.fetchTags = settings.fetchTags;
1541- const refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
1541+ const refSpec = refHelper.getRefSpec(settings.ref, settings.commit, settings.additionalFetchRefs );
15421542 yield git.fetch(refSpec, fetchOptions);
15431543 }
15441544 core.endGroup();
@@ -2013,6 +2013,10 @@ function getInputs() {
20132013 result.singleBranch =
20142014 (core.getInput('single-branch') || 'false').toUpperCase() === 'TRUE';
20152015 core.debug(`single branch = ${result.singleBranch}`);
2016+ // Additional fetch refs
2017+ result.additionalFetchRefs =
2018+ core.getMultilineInput('additional-fetch-refs') || [];
2019+ core.debug(`additional fetch refs = ${JSON.stringify(result.additionalFetchRefs)}`);
20162020 // Clean
20172021 result.clean = (core.getInput('clean') || 'true').toUpperCase() === 'TRUE';
20182022 core.debug(`clean = ${result.clean}`);
@@ -2223,6 +2227,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
22232227exports.tagsRefSpec = void 0;
22242228exports.getCheckoutInfo = getCheckoutInfo;
22252229exports.getRefSpecForAllHistory = getRefSpecForAllHistory;
2230+ exports.getSingleRefSpec = getSingleRefSpec;
22262231exports.getRefSpec = getRefSpec;
22272232exports.testRef = testRef;
22282233exports.checkCommitInfo = checkCommitInfo;
@@ -2287,7 +2292,7 @@ function getRefSpecForAllHistory(ref, commit) {
22872292 }
22882293 return result;
22892294}
2290- function getRefSpec (ref, commit) {
2295+ function getSingleRefSpec (ref, commit) {
22912296 if (!ref && !commit) {
22922297 throw new Error('Args ref and commit cannot both be empty');
22932298 }
@@ -2335,6 +2340,16 @@ function getRefSpec(ref, commit) {
23352340 return [`+${ref}:${ref}`];
23362341 }
23372342}
2343+ function getRefSpec(ref, commit, additionalFetchRefs) {
2344+ const result = [];
2345+ const singleRefSpec = getSingleRefSpec(ref, commit);
2346+ result.push(...singleRefSpec);
2347+ for (const additionalRef of additionalFetchRefs) {
2348+ const additionalRefSpec = getSingleRefSpec(additionalRef, '');
2349+ result.push(...additionalRefSpec);
2350+ }
2351+ return result;
2352+ }
23382353/**
23392354 * Tests whether the initial fetch created the ref at the expected commit
23402355 */
0 commit comments