mirror of
https://github.com/actions/checkout.git
synced 2025-04-21 01:56:45 +00:00
Add string[] option to submodules
Allows checking out only specific submodules instead of all
This commit is contained in:
parent
9a9194f871
commit
b6625bb44a
10 changed files with 128 additions and 22 deletions
|
@ -813,6 +813,7 @@ async function setup(testName: string): Promise<void> {
|
|||
lfs: false,
|
||||
submodules: false,
|
||||
nestedSubmodules: false,
|
||||
submoduleDirectories: null,
|
||||
persistCredentials: true,
|
||||
ref: 'refs/heads/main',
|
||||
repositoryName: 'my-repo',
|
||||
|
|
|
@ -21,6 +21,13 @@ describe('input-helper tests', () => {
|
|||
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
|
||||
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
|
||||
jest.spyOn(core, 'error').mockImplementation(jest.fn())
|
||||
|
@ -87,6 +94,7 @@ describe('input-helper tests', () => {
|
|||
expect(settings.showProgress).toBe(true)
|
||||
expect(settings.lfs).toBe(false)
|
||||
expect(settings.ref).toBe('refs/heads/some-ref')
|
||||
expect(settings.submoduleDirectories).toBe(null)
|
||||
expect(settings.repositoryName).toBe('some-repo')
|
||||
expect(settings.repositoryOwner).toBe('some-owner')
|
||||
expect(settings.repositoryPath).toBe(gitHubWorkspace)
|
||||
|
@ -144,4 +152,13 @@ describe('input-helper tests', () => {
|
|||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue