This commit is contained in:
CrazyMax 2026-05-22 17:45:39 +02:00 committed by GitHub
commit a1e6c1f81b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 4 deletions

View File

@ -95,6 +95,25 @@ describe('getInputs', () => {
expect(gitContextSpy).toHaveBeenCalledTimes(1);
gitContextSpy.mockRestore();
});
test('requests untrimmed secrets input explicitly', async () => {
const gitContext = 'https://github.com/docker/build-push-action.git#refs/heads/master';
const gitContextSpy = vi.spyOn(Build.prototype, 'gitContext').mockResolvedValue(gitContext);
const getInputList = vi.fn().mockReturnValue([]);
vi.resetModules();
vi.doMock('@docker/actions-toolkit/lib/util.js', () => ({
Util: {
getInputList
}
}));
setRequiredBooleanInputs();
setInput('secrets', `"PRIVATE_SSH_KEY=test\n\n"`);
const context = await import('../src/context.js');
await context.getInputs();
expect(getInputList).toHaveBeenCalledWith('secrets', {ignoreComma: true, trimWhitespace: false});
vi.doUnmock('@docker/actions-toolkit/lib/util.js');
gitContextSpy.mockRestore();
});
});
describe('getArgs', () => {

2
dist/index.cjs generated vendored

File diff suppressed because one or more lines are too long

4
dist/index.cjs.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -76,7 +76,7 @@ export async function getInputs(): Promise<Inputs> {
pull: core.getBooleanInput('pull'),
push: core.getBooleanInput('push'),
sbom: core.getInput('sbom'),
secrets: Util.getInputList('secrets', {ignoreComma: true}),
secrets: Util.getInputList('secrets', {ignoreComma: true, trimWhitespace: false}),
'secret-envs': Util.getInputList('secret-envs'),
'secret-files': Util.getInputList('secret-files', {ignoreComma: true}),
'shm-size': core.getInput('shm-size'),