Skip to content

Commit d4bf874

Browse files
authored
Merge pull request #1538 from crazy-max/secrets-no-trim
preserve trailing whitespace in secrets input
2 parents a00e37f + be16586 commit d4bf874

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

__tests__/context.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ describe('getInputs', () => {
9595
expect(gitContextSpy).toHaveBeenCalledTimes(1);
9696
gitContextSpy.mockRestore();
9797
});
98+
99+
test('requests untrimmed secrets input explicitly', async () => {
100+
const gitContext = 'https://github.com/docker/build-push-action.git#refs/heads/master';
101+
const gitContextSpy = vi.spyOn(Build.prototype, 'gitContext').mockResolvedValue(gitContext);
102+
const getInputList = vi.fn().mockReturnValue([]);
103+
vi.resetModules();
104+
vi.doMock('@docker/actions-toolkit/lib/util.js', () => ({
105+
Util: {
106+
getInputList
107+
}
108+
}));
109+
setRequiredBooleanInputs();
110+
setInput('secrets', `"PRIVATE_SSH_KEY=test\n\n"`);
111+
const context = await import('../src/context.js');
112+
await context.getInputs();
113+
expect(getInputList).toHaveBeenCalledWith('secrets', {ignoreComma: true, trimWhitespace: false});
114+
vi.doUnmock('@docker/actions-toolkit/lib/util.js');
115+
gitContextSpy.mockRestore();
116+
});
98117
});
99118

100119
describe('getArgs', () => {

0 commit comments

Comments
 (0)