Add support for multi-line secrets in setSecret

This commit is contained in:
Francesco Renzi
2023-05-22 14:21:05 +01:00
parent 37e09c586f
commit 5ccbd5f448
3 changed files with 18 additions and 2 deletions

View File

@@ -164,6 +164,15 @@ describe('@actions/core', () => {
assertWriteCalls([`::add-mask::secret val${os.EOL}`])
})
it('setSecret splits multi line secrets into multiple commands', () => {
core.setSecret('first\nsecond\r\nthird')
assertWriteCalls([
`::add-mask::first${os.EOL}`,
`::add-mask::second${os.EOL}`,
`::add-mask::third${os.EOL}`
])
})
it('prependPath produces the correct commands and sets the env', () => {
const command = 'PATH'
createFileCommandFile(command)