Compare commits

...

5 Commits

Author SHA1 Message Date
Marcus Tillmanns
65e5c2e969
Merge 7618b1f401 into 6d193bf280 2024-09-05 22:40:10 -05:00
dependabot[bot]
6d193bf280
Bump braces from 3.0.2 to 3.0.3 (#1777)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-05 15:04:42 -04:00
dependabot[bot]
db0cee9a51
Bump the minor-npm-dependencies group across 1 directory with 4 updates (#1872)
* Bump the minor-npm-dependencies group across 1 directory with 4 updates

Bumps the minor-npm-dependencies group with 4 updates in the / directory: [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest), [prettier](https://github.com/prettier/prettier), [ts-jest](https://github.com/kulshekhar/ts-jest) and [typescript](https://github.com/Microsoft/TypeScript).


Updates `eslint-plugin-jest` from 28.5.0 to 28.8.2
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v28.5.0...v28.8.2)

Updates `prettier` from 3.2.5 to 3.3.3
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.2.5...3.3.3)

Updates `ts-jest` from 29.1.2 to 29.2.5
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.1.2...v29.2.5)

Updates `typescript` from 5.4.5 to 5.5.4
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.5...v5.5.4)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-npm-dependencies
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-npm-dependencies
- dependency-name: ts-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-npm-dependencies
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-npm-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* `npm run build`

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Gross <joshmgross@github.com>
2024-09-05 15:04:17 -04:00
Marcus Tillmanns
7618b1f401 Simplified the submoduleDirectories 2024-08-28 13:16:59 +02:00
Marcus Tillmanns
b6625bb44a Add string[] option to submodules
Allows checking out only specific submodules instead of all
2024-08-27 10:37:37 +02:00
12 changed files with 241 additions and 108 deletions

View File

@ -154,6 +154,17 @@ jobs:
submodules: true submodules: true
- name: Verify submodules true - name: Verify submodules true
run: __test__/verify-submodules-true.sh run: __test__/verify-submodules-true.sh
# Submodules limited
- name: Checkout submodules limited
uses: ./
with:
ref: test-data/v2/submodule-ssh-url
path: submodules-true
submodules: true
submodule-directories: submodule-level-1
- name: Verify submodules true
run: __test__/verify-submodules-true.sh
# Submodules recursive # Submodules recursive
- name: Checkout submodules recursive - name: Checkout submodules recursive

View File

@ -116,6 +116,10 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
# Default: false # Default: false
submodules: '' submodules: ''
# A list of submodules to checkout.
# Default: null
submodule-directories: ''
# Add repository path as safe.directory for Git global config by running `git # Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>` # config --global --add safe.directory <path>`
# Default: true # Default: true

View File

@ -813,6 +813,7 @@ async function setup(testName: string): Promise<void> {
lfs: false, lfs: false,
submodules: false, submodules: false,
nestedSubmodules: false, nestedSubmodules: false,
submoduleDirectories: [],
persistCredentials: true, persistCredentials: true,
ref: 'refs/heads/main', ref: 'refs/heads/main',
repositoryName: 'my-repo', repositoryName: 'my-repo',

View File

@ -21,6 +21,13 @@ describe('input-helper tests', () => {
jest.spyOn(core, 'getInput').mockImplementation((name: string) => { jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
return inputs[name] return inputs[name]
}) })
// Mock getMultilineInput
jest.spyOn(core, 'getMultilineInput').mockImplementation((name: string) => {
const input: string[] = (inputs[name] || '')
.split('\n')
.filter(x => x !== '')
return input.map(inp => inp.trim())
})
// Mock error/warning/info/debug // Mock error/warning/info/debug
jest.spyOn(core, 'error').mockImplementation(jest.fn()) jest.spyOn(core, 'error').mockImplementation(jest.fn())
@ -87,6 +94,7 @@ describe('input-helper tests', () => {
expect(settings.showProgress).toBe(true) expect(settings.showProgress).toBe(true)
expect(settings.lfs).toBe(false) expect(settings.lfs).toBe(false)
expect(settings.ref).toBe('refs/heads/some-ref') expect(settings.ref).toBe('refs/heads/some-ref')
expect(settings.submoduleDirectories).toStrictEqual([])
expect(settings.repositoryName).toBe('some-repo') expect(settings.repositoryName).toBe('some-repo')
expect(settings.repositoryOwner).toBe('some-owner') expect(settings.repositoryOwner).toBe('some-owner')
expect(settings.repositoryPath).toBe(gitHubWorkspace) expect(settings.repositoryPath).toBe(gitHubWorkspace)
@ -144,4 +152,13 @@ describe('input-helper tests', () => {
const settings: IGitSourceSettings = await inputHelper.getInputs() const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.workflowOrganizationId).toBe(123456) expect(settings.workflowOrganizationId).toBe(123456)
}) })
it('sets submoduleDirectories', async () => {
inputs['submodule-directories'] = 'submodule1\nsubmodule2'
const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.submoduleDirectories).toStrictEqual([
'submodule1',
'submodule2'
])
expect(settings.submodules).toBe(true)
})
}) })

View File

@ -92,6 +92,10 @@ inputs:
When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are
converted to HTTPS. converted to HTTPS.
default: false default: false
submodule-directories:
description: >
A list of submodules to checkout.
default: null
set-safe-directory: set-safe-directory:
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>` description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`
default: true default: true

85
dist/index.js vendored
View File

@ -30,7 +30,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.fileExistsSync = exports.existsSync = exports.directoryExistsSync = void 0; exports.directoryExistsSync = directoryExistsSync;
exports.existsSync = existsSync;
exports.fileExistsSync = fileExistsSync;
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
function directoryExistsSync(path, required) { function directoryExistsSync(path, required) {
var _a; var _a;
@ -58,7 +60,6 @@ function directoryExistsSync(path, required) {
} }
throw new Error(`Directory '${path}' does not exist`); throw new Error(`Directory '${path}' does not exist`);
} }
exports.directoryExistsSync = directoryExistsSync;
function existsSync(path) { function existsSync(path) {
var _a; var _a;
if (!path) { if (!path) {
@ -75,7 +76,6 @@ function existsSync(path) {
} }
return true; return true;
} }
exports.existsSync = existsSync;
function fileExistsSync(path) { function fileExistsSync(path) {
var _a; var _a;
if (!path) { if (!path) {
@ -96,7 +96,6 @@ function fileExistsSync(path) {
} }
return false; return false;
} }
exports.fileExistsSync = fileExistsSync;
/***/ }), /***/ }),
@ -139,7 +138,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createAuthHelper = void 0; exports.createAuthHelper = createAuthHelper;
const assert = __importStar(__nccwpck_require__(9491)); const assert = __importStar(__nccwpck_require__(9491));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
@ -156,7 +155,6 @@ const SSH_COMMAND_KEY = 'core.sshCommand';
function createAuthHelper(git, settings) { function createAuthHelper(git, settings) {
return new GitAuthHelper(git, settings); return new GitAuthHelper(git, settings);
} }
exports.createAuthHelper = createAuthHelper;
class GitAuthHelper { class GitAuthHelper {
constructor(gitCommandManager, gitSourceSettings) { constructor(gitCommandManager, gitSourceSettings) {
this.insteadOfValues = []; this.insteadOfValues = [];
@ -475,7 +473,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createCommandManager = exports.MinimumGitSparseCheckoutVersion = exports.MinimumGitVersion = void 0; exports.MinimumGitSparseCheckoutVersion = exports.MinimumGitVersion = void 0;
exports.createCommandManager = createCommandManager;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
@ -496,7 +495,6 @@ function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout); return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
}); });
} }
exports.createCommandManager = createCommandManager;
class GitCommandManager { class GitCommandManager {
// Private constructor; use createCommandManager() // Private constructor; use createCommandManager()
constructor() { constructor() {
@ -795,10 +793,10 @@ class GitCommandManager {
yield this.execGit(args); yield this.execGit(args);
}); });
} }
submoduleUpdate(fetchDepth, recursive) { submoduleUpdate(fetchDepth, recursive, submoduleDirectories) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const args = ['-c', 'protocol.version=2']; const args = ['-c', 'protocol.version=2'];
args.push('submodule', 'update', '--init', '--force'); args.push('submodule', 'update', '--init', '--force', ...submoduleDirectories);
if (fetchDepth > 0) { if (fetchDepth > 0) {
args.push(`--depth=${fetchDepth}`); args.push(`--depth=${fetchDepth}`);
} }
@ -1020,7 +1018,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.prepareExistingDirectory = void 0; exports.prepareExistingDirectory = prepareExistingDirectory;
const assert = __importStar(__nccwpck_require__(9491)); const assert = __importStar(__nccwpck_require__(9491));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
@ -1124,7 +1122,6 @@ function prepareExistingDirectory(git, repositoryPath, repositoryUrl, clean, ref
} }
}); });
} }
exports.prepareExistingDirectory = prepareExistingDirectory;
/***/ }), /***/ }),
@ -1167,7 +1164,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.cleanup = exports.getSource = void 0; exports.getSource = getSource;
exports.cleanup = cleanup;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fsHelper = __importStar(__nccwpck_require__(7219)); const fsHelper = __importStar(__nccwpck_require__(7219));
const gitAuthHelper = __importStar(__nccwpck_require__(2565)); const gitAuthHelper = __importStar(__nccwpck_require__(2565));
@ -1342,7 +1340,7 @@ function getSource(settings) {
// Checkout submodules // Checkout submodules
core.startGroup('Fetching submodules'); core.startGroup('Fetching submodules');
yield git.submoduleSync(settings.nestedSubmodules); yield git.submoduleSync(settings.nestedSubmodules);
yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules); yield git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules, settings.submoduleDirectories);
yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules); yield git.submoduleForeach('git config --local gc.auto 0', settings.nestedSubmodules);
core.endGroup(); core.endGroup();
// Persist credentials // Persist credentials
@ -1373,7 +1371,6 @@ function getSource(settings) {
} }
}); });
} }
exports.getSource = getSource;
function cleanup(repositoryPath) { function cleanup(repositoryPath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Repo exists? // Repo exists?
@ -1409,7 +1406,6 @@ function cleanup(repositoryPath) {
} }
}); });
} }
exports.cleanup = cleanup;
function getGitCommandManager(settings) { function getGitCommandManager(settings) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info(`Working directory is '${settings.repositoryPath}'`); core.info(`Working directory is '${settings.repositoryPath}'`);
@ -1548,7 +1544,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getDefaultBranch = exports.downloadRepository = void 0; exports.downloadRepository = downloadRepository;
exports.getDefaultBranch = getDefaultBranch;
const assert = __importStar(__nccwpck_require__(9491)); const assert = __importStar(__nccwpck_require__(9491));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
@ -1612,7 +1609,6 @@ function downloadRepository(authToken, owner, repo, ref, commit, repositoryPath,
yield io.rmRF(extractPath); yield io.rmRF(extractPath);
}); });
} }
exports.downloadRepository = downloadRepository;
/** /**
* Looks up the default branch name * Looks up the default branch name
*/ */
@ -1651,7 +1647,6 @@ function getDefaultBranch(authToken, owner, repo, baseUrl) {
})); }));
}); });
} }
exports.getDefaultBranch = getDefaultBranch;
function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) { function downloadArchive(authToken, owner, repo, ref, commit, baseUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const octokit = github.getOctokit(authToken, { const octokit = github.getOctokit(authToken, {
@ -1710,7 +1705,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getInputs = void 0; exports.getInputs = getInputs;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fsHelper = __importStar(__nccwpck_require__(7219)); const fsHelper = __importStar(__nccwpck_require__(7219));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
@ -1806,6 +1801,7 @@ function getInputs() {
// Submodules // Submodules
result.submodules = false; result.submodules = false;
result.nestedSubmodules = false; result.nestedSubmodules = false;
result.submoduleDirectories = [];
const submodulesString = (core.getInput('submodules') || '').toUpperCase(); const submodulesString = (core.getInput('submodules') || '').toUpperCase();
if (submodulesString == 'RECURSIVE') { if (submodulesString == 'RECURSIVE') {
result.submodules = true; result.submodules = true;
@ -1814,8 +1810,15 @@ function getInputs() {
else if (submodulesString == 'TRUE') { else if (submodulesString == 'TRUE') {
result.submodules = true; result.submodules = true;
} }
const submoduleDirectories = core.getMultilineInput('submodule-directories');
if (submoduleDirectories.length > 0) {
result.submoduleDirectories = submoduleDirectories;
if (!result.submodules)
result.submodules = true;
}
core.debug(`submodules = ${result.submodules}`); core.debug(`submodules = ${result.submodules}`);
core.debug(`recursive submodules = ${result.nestedSubmodules}`); core.debug(`recursive submodules = ${result.nestedSubmodules}`);
core.debug(`submodule directories = ${result.submoduleDirectories}`);
// Auth token // Auth token
result.authToken = core.getInput('token', { required: true }); result.authToken = core.getInput('token', { required: true });
// SSH // SSH
@ -1839,7 +1842,6 @@ function getInputs() {
return result; return result;
}); });
} }
exports.getInputs = getInputs;
/***/ }), /***/ }),
@ -1971,7 +1973,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.checkCommitInfo = exports.testRef = exports.getRefSpec = exports.getRefSpecForAllHistory = exports.getCheckoutInfo = exports.tagsRefSpec = void 0; exports.tagsRefSpec = void 0;
exports.getCheckoutInfo = getCheckoutInfo;
exports.getRefSpecForAllHistory = getRefSpecForAllHistory;
exports.getRefSpec = getRefSpec;
exports.testRef = testRef;
exports.checkCommitInfo = checkCommitInfo;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const github = __importStar(__nccwpck_require__(5438)); const github = __importStar(__nccwpck_require__(5438));
const url_helper_1 = __nccwpck_require__(9437); const url_helper_1 = __nccwpck_require__(9437);
@ -2025,7 +2032,6 @@ function getCheckoutInfo(git, ref, commit) {
return result; return result;
}); });
} }
exports.getCheckoutInfo = getCheckoutInfo;
function getRefSpecForAllHistory(ref, commit) { function getRefSpecForAllHistory(ref, commit) {
const result = ['+refs/heads/*:refs/remotes/origin/*', exports.tagsRefSpec]; const result = ['+refs/heads/*:refs/remotes/origin/*', exports.tagsRefSpec];
if (ref && ref.toUpperCase().startsWith('REFS/PULL/')) { if (ref && ref.toUpperCase().startsWith('REFS/PULL/')) {
@ -2034,7 +2040,6 @@ function getRefSpecForAllHistory(ref, commit) {
} }
return result; return result;
} }
exports.getRefSpecForAllHistory = getRefSpecForAllHistory;
function getRefSpec(ref, commit) { function getRefSpec(ref, commit) {
if (!ref && !commit) { if (!ref && !commit) {
throw new Error('Args ref and commit cannot both be empty'); throw new Error('Args ref and commit cannot both be empty');
@ -2083,7 +2088,6 @@ function getRefSpec(ref, commit) {
return [`+${ref}:${ref}`]; return [`+${ref}:${ref}`];
} }
} }
exports.getRefSpec = getRefSpec;
/** /**
* Tests whether the initial fetch created the ref at the expected commit * Tests whether the initial fetch created the ref at the expected commit
*/ */
@ -2127,7 +2131,6 @@ function testRef(git, ref, commit) {
} }
}); });
} }
exports.testRef = testRef;
function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) { function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref, commit, baseUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a; var _a;
@ -2193,7 +2196,6 @@ function checkCommitInfo(token, commitInfo, repositoryOwner, repositoryName, ref
} }
}); });
} }
exports.checkCommitInfo = checkCommitInfo;
function fromPayload(path) { function fromPayload(path) {
return select(github.context.payload, path); return select(github.context.payload, path);
} }
@ -2218,13 +2220,12 @@ function select(obj, path) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.escape = void 0; exports.escape = escape;
function escape(value) { function escape(value) {
return value.replace(/[^a-zA-Z0-9_]/g, x => { return value.replace(/[^a-zA-Z0-9_]/g, x => {
return `\\${x}`; return `\\${x}`;
}); });
} }
exports.escape = escape;
/***/ }), /***/ }),
@ -2267,7 +2268,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.execute = exports.RetryHelper = void 0; exports.RetryHelper = void 0;
exports.execute = execute;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const defaultMaxAttempts = 3; const defaultMaxAttempts = 3;
const defaultMinSeconds = 10; const defaultMinSeconds = 10;
@ -2319,7 +2321,6 @@ function execute(action) {
return yield retryHelper.execute(action); return yield retryHelper.execute(action);
}); });
} }
exports.execute = execute;
/***/ }), /***/ }),
@ -2353,7 +2354,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setSafeDirectory = exports.setSshKnownHostsPath = exports.setSshKeyPath = exports.setRepositoryPath = exports.SshKnownHostsPath = exports.SshKeyPath = exports.PostSetSafeDirectory = exports.RepositoryPath = exports.IsPost = void 0; exports.SshKnownHostsPath = exports.SshKeyPath = exports.PostSetSafeDirectory = exports.RepositoryPath = exports.IsPost = void 0;
exports.setRepositoryPath = setRepositoryPath;
exports.setSshKeyPath = setSshKeyPath;
exports.setSshKnownHostsPath = setSshKnownHostsPath;
exports.setSafeDirectory = setSafeDirectory;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
/** /**
* Indicates whether the POST action is running * Indicates whether the POST action is running
@ -2381,28 +2386,24 @@ exports.SshKnownHostsPath = core.getState('sshKnownHostsPath');
function setRepositoryPath(repositoryPath) { function setRepositoryPath(repositoryPath) {
core.saveState('repositoryPath', repositoryPath); core.saveState('repositoryPath', repositoryPath);
} }
exports.setRepositoryPath = setRepositoryPath;
/** /**
* Save the SSH key path so the POST action can retrieve the value. * Save the SSH key path so the POST action can retrieve the value.
*/ */
function setSshKeyPath(sshKeyPath) { function setSshKeyPath(sshKeyPath) {
core.saveState('sshKeyPath', sshKeyPath); core.saveState('sshKeyPath', sshKeyPath);
} }
exports.setSshKeyPath = setSshKeyPath;
/** /**
* Save the SSH known hosts path so the POST action can retrieve the value. * Save the SSH known hosts path so the POST action can retrieve the value.
*/ */
function setSshKnownHostsPath(sshKnownHostsPath) { function setSshKnownHostsPath(sshKnownHostsPath) {
core.saveState('sshKnownHostsPath', sshKnownHostsPath); core.saveState('sshKnownHostsPath', sshKnownHostsPath);
} }
exports.setSshKnownHostsPath = setSshKnownHostsPath;
/** /**
* Save the set-safe-directory input so the POST action can retrieve the value. * Save the set-safe-directory input so the POST action can retrieve the value.
*/ */
function setSafeDirectory() { function setSafeDirectory() {
core.saveState('setSafeDirectory', 'true'); core.saveState('setSafeDirectory', 'true');
} }
exports.setSafeDirectory = setSafeDirectory;
// Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic. // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic.
// This is necessary since we don't have a separate entry point. // This is necessary since we don't have a separate entry point.
if (!exports.IsPost) { if (!exports.IsPost) {
@ -2441,7 +2442,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result; return result;
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isGhes = exports.getServerApiUrl = exports.getServerUrl = exports.getFetchUrl = void 0; exports.getFetchUrl = getFetchUrl;
exports.getServerUrl = getServerUrl;
exports.getServerApiUrl = getServerApiUrl;
exports.isGhes = isGhes;
const assert = __importStar(__nccwpck_require__(9491)); const assert = __importStar(__nccwpck_require__(9491));
const url_1 = __nccwpck_require__(7310); const url_1 = __nccwpck_require__(7310);
function getFetchUrl(settings) { function getFetchUrl(settings) {
@ -2457,14 +2461,12 @@ function getFetchUrl(settings) {
// "origin" is SCHEME://HOSTNAME[:PORT] // "origin" is SCHEME://HOSTNAME[:PORT]
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`; return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
} }
exports.getFetchUrl = getFetchUrl;
function getServerUrl(url) { function getServerUrl(url) {
let urlValue = url && url.trim().length > 0 let urlValue = url && url.trim().length > 0
? url ? url
: process.env['GITHUB_SERVER_URL'] || 'https://github.com'; : process.env['GITHUB_SERVER_URL'] || 'https://github.com';
return new url_1.URL(urlValue); return new url_1.URL(urlValue);
} }
exports.getServerUrl = getServerUrl;
function getServerApiUrl(url) { function getServerApiUrl(url) {
let apiUrl = 'https://api.github.com'; let apiUrl = 'https://api.github.com';
if (isGhes(url)) { if (isGhes(url)) {
@ -2473,12 +2475,10 @@ function getServerApiUrl(url) {
} }
return apiUrl; return apiUrl;
} }
exports.getServerApiUrl = getServerApiUrl;
function isGhes(url) { function isGhes(url) {
const ghUrl = getServerUrl(url); const ghUrl = getServerUrl(url);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
} }
exports.isGhes = isGhes;
/***/ }), /***/ }),
@ -2521,7 +2521,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getOrganizationId = void 0; exports.getOrganizationId = getOrganizationId;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fs = __importStar(__nccwpck_require__(7147)); const fs = __importStar(__nccwpck_require__(7147));
/** /**
@ -2550,7 +2550,6 @@ function getOrganizationId() {
} }
}); });
} }
exports.getOrganizationId = getOrganizationId;
/***/ }), /***/ }),

178
package-lock.json generated
View File

@ -25,13 +25,13 @@
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^28.5.0", "eslint-plugin-jest": "^28.8.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.2.5", "prettier": "^3.3.3",
"ts-jest": "^29.1.2", "ts-jest": "^29.2.5",
"typescript": "^5.4.5" "typescript": "^5.5.4"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
@ -2080,6 +2080,12 @@
"integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==",
"dev": true "dev": true
}, },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
"integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
"dev": true
},
"node_modules/available-typed-arrays": { "node_modules/available-typed-arrays": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@ -2241,12 +2247,12 @@
} }
}, },
"node_modules/braces": { "node_modules/braces": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"fill-range": "^7.0.1" "fill-range": "^7.1.1"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@ -2702,6 +2708,21 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/ejs": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
"integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==",
"dev": true,
"dependencies": {
"jake": "^10.8.5"
},
"bin": {
"ejs": "bin/cli.js"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.747", "version": "1.4.747",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.747.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.747.tgz",
@ -3197,18 +3218,18 @@
} }
}, },
"node_modules/eslint-plugin-jest": { "node_modules/eslint-plugin-jest": {
"version": "28.5.0", "version": "28.8.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.5.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.2.tgz",
"integrity": "sha512-6np6DGdmNq/eBbA7HOUNV8fkfL86PYwBfwyb8n23FXgJNTR8+ot3smRHjza9LGsBBZRypK3qyF79vMjohIL8eQ==", "integrity": "sha512-mC3OyklHmS5i7wYU1rGId9EnxRI8TVlnFG56AE+8U9iRy6zwaNygZR+DsdZuCL0gRG0wVeyzq+uWcPt6yJrrMA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@typescript-eslint/utils": "^6.0.0 || ^7.0.0" "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0"
}, },
"engines": { "engines": {
"node": "^16.10.0 || ^18.12.0 || >=20.0.0" "node": "^16.10.0 || ^18.12.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0 || ^8.0.0",
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0",
"jest": "*" "jest": "*"
}, },
@ -3573,10 +3594,31 @@
"node": "^10.12.0 || >=12.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"dev": true,
"dependencies": {
"minimatch": "^5.0.1"
}
},
"node_modules/filelist/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/fill-range": { "node_modules/fill-range": {
"version": "7.0.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
@ -4574,6 +4616,46 @@
"set-function-name": "^2.0.1" "set-function-name": "^2.0.1"
} }
}, },
"node_modules/jake": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz",
"integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==",
"dev": true,
"dependencies": {
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"bin": {
"jake": "bin/cli.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/jake/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/jake/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/jest": { "node_modules/jest": {
"version": "29.7.0", "version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
@ -5896,9 +5978,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "3.2.5", "version": "3.3.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
"dev": true, "dev": true,
"bin": { "bin": {
"prettier": "bin/prettier.cjs" "prettier": "bin/prettier.cjs"
@ -6607,28 +6689,30 @@
} }
}, },
"node_modules/ts-jest": { "node_modules/ts-jest": {
"version": "29.1.2", "version": "29.2.5",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.5.tgz",
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "integrity": "sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"bs-logger": "0.x", "bs-logger": "^0.2.6",
"fast-json-stable-stringify": "2.x", "ejs": "^3.1.10",
"fast-json-stable-stringify": "^2.1.0",
"jest-util": "^29.0.0", "jest-util": "^29.0.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"lodash.memoize": "4.x", "lodash.memoize": "^4.1.2",
"make-error": "1.x", "make-error": "^1.3.6",
"semver": "^7.5.3", "semver": "^7.6.3",
"yargs-parser": "^21.0.1" "yargs-parser": "^21.1.1"
}, },
"bin": { "bin": {
"ts-jest": "cli.js" "ts-jest": "cli.js"
}, },
"engines": { "engines": {
"node": "^16.10.0 || ^18.0.0 || >=20.0.0" "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": ">=7.0.0-beta.0 <8", "@babel/core": ">=7.0.0-beta.0 <8",
"@jest/transform": "^29.0.0",
"@jest/types": "^29.0.0", "@jest/types": "^29.0.0",
"babel-jest": "^29.0.0", "babel-jest": "^29.0.0",
"jest": "^29.0.0", "jest": "^29.0.0",
@ -6638,6 +6722,9 @@
"@babel/core": { "@babel/core": {
"optional": true "optional": true
}, },
"@jest/transform": {
"optional": true
},
"@jest/types": { "@jest/types": {
"optional": true "optional": true
}, },
@ -6649,26 +6736,11 @@
} }
} }
}, },
"node_modules/ts-jest/node_modules/lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ts-jest/node_modules/semver": { "node_modules/ts-jest/node_modules/semver": {
"version": "7.6.0", "version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"dev": true, "dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
}, },
@ -6676,12 +6748,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/ts-jest/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
"node_modules/tsconfig-paths": { "node_modules/tsconfig-paths": {
"version": "3.15.0", "version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
@ -6836,9 +6902,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.4.5", "version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",

View File

@ -44,12 +44,12 @@
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^28.5.0", "eslint-plugin-jest": "^28.8.2",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.2.5", "prettier": "^3.3.3",
"ts-jest": "^29.1.2", "ts-jest": "^29.2.5",
"typescript": "^5.4.5" "typescript": "^5.5.4"
} }
} }

View File

@ -54,7 +54,11 @@ export interface IGitCommandManager {
shaExists(sha: string): Promise<boolean> shaExists(sha: string): Promise<boolean>
submoduleForeach(command: string, recursive: boolean): Promise<string> submoduleForeach(command: string, recursive: boolean): Promise<string>
submoduleSync(recursive: boolean): Promise<void> submoduleSync(recursive: boolean): Promise<void>
submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> submoduleUpdate(
fetchDepth: number,
recursive: boolean,
submoduleDirectories: string[]
): Promise<void>
submoduleStatus(): Promise<boolean> submoduleStatus(): Promise<boolean>
tagExists(pattern: string): Promise<boolean> tagExists(pattern: string): Promise<boolean>
tryClean(): Promise<boolean> tryClean(): Promise<boolean>
@ -409,9 +413,19 @@ class GitCommandManager {
await this.execGit(args) await this.execGit(args)
} }
async submoduleUpdate(fetchDepth: number, recursive: boolean): Promise<void> { async submoduleUpdate(
fetchDepth: number,
recursive: boolean,
submoduleDirectories: string[]
): Promise<void> {
const args = ['-c', 'protocol.version=2'] const args = ['-c', 'protocol.version=2']
args.push('submodule', 'update', '--init', '--force') args.push(
'submodule',
'update',
'--init',
'--force',
...submoduleDirectories
)
if (fetchDepth > 0) { if (fetchDepth > 0) {
args.push(`--depth=${fetchDepth}`) args.push(`--depth=${fetchDepth}`)
} }

View File

@ -242,7 +242,11 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
// Checkout submodules // Checkout submodules
core.startGroup('Fetching submodules') core.startGroup('Fetching submodules')
await git.submoduleSync(settings.nestedSubmodules) await git.submoduleSync(settings.nestedSubmodules)
await git.submoduleUpdate(settings.fetchDepth, settings.nestedSubmodules) await git.submoduleUpdate(
settings.fetchDepth,
settings.nestedSubmodules,
settings.submoduleDirectories
)
await git.submoduleForeach( await git.submoduleForeach(
'git config --local gc.auto 0', 'git config --local gc.auto 0',
settings.nestedSubmodules settings.nestedSubmodules

View File

@ -74,6 +74,11 @@ export interface IGitSourceSettings {
*/ */
nestedSubmodules: boolean nestedSubmodules: boolean
/**
* Indicates which submodule paths to checkout
*/
submoduleDirectories: string[]
/** /**
* The auth token to use when fetching the repository * The auth token to use when fetching the repository
*/ */

View File

@ -125,6 +125,7 @@ export async function getInputs(): Promise<IGitSourceSettings> {
// Submodules // Submodules
result.submodules = false result.submodules = false
result.nestedSubmodules = false result.nestedSubmodules = false
result.submoduleDirectories = []
const submodulesString = (core.getInput('submodules') || '').toUpperCase() const submodulesString = (core.getInput('submodules') || '').toUpperCase()
if (submodulesString == 'RECURSIVE') { if (submodulesString == 'RECURSIVE') {
result.submodules = true result.submodules = true
@ -132,9 +133,16 @@ export async function getInputs(): Promise<IGitSourceSettings> {
} else if (submodulesString == 'TRUE') { } else if (submodulesString == 'TRUE') {
result.submodules = true result.submodules = true
} }
const submoduleDirectories = core.getMultilineInput('submodule-directories')
if (submoduleDirectories.length > 0) {
result.submoduleDirectories = submoduleDirectories
if (!result.submodules) result.submodules = true
}
core.debug(`submodules = ${result.submodules}`) core.debug(`submodules = ${result.submodules}`)
core.debug(`recursive submodules = ${result.nestedSubmodules}`) core.debug(`recursive submodules = ${result.nestedSubmodules}`)
core.debug(`submodule directories = ${result.submoduleDirectories}`)
// Auth token // Auth token
result.authToken = core.getInput('token', {required: true}) result.authToken = core.getInput('token', {required: true})