mirror of https://github.com/actions/toolkit
parent
4beda9cbc0
commit
30995490f2
File diff suppressed because it is too large
Load Diff
|
@ -24,7 +24,7 @@
|
||||||
"eslint-plugin-jest": "^22.21.0",
|
"eslint-plugin-jest": "^22.21.0",
|
||||||
"flow-bin": "^0.115.0",
|
"flow-bin": "^0.115.0",
|
||||||
"jest": "^27.2.5",
|
"jest": "^27.2.5",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^5.4.0",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"ts-jest": "^27.0.5",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^3.9.9"
|
"typescript": "^3.9.9"
|
||||||
|
|
|
@ -135,7 +135,9 @@ describe('@actions/core', () => {
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
core.exportVariable('my var', `good stuff ${DELIMITER} bad stuff`)
|
core.exportVariable('my var', `good stuff ${DELIMITER} bad stuff`)
|
||||||
}).toThrow(`Unexpected input: value should not contain the delimiter "${DELIMITER}"`)
|
}).toThrow(
|
||||||
|
`Unexpected input: value should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
const filePath = path.join(__dirname, `test/${command}`)
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
fs.unlinkSync(filePath)
|
fs.unlinkSync(filePath)
|
||||||
|
@ -147,7 +149,9 @@ describe('@actions/core', () => {
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
core.exportVariable(`good stuff ${DELIMITER} bad stuff`, 'test')
|
core.exportVariable(`good stuff ${DELIMITER} bad stuff`, 'test')
|
||||||
}).toThrow(`Unexpected input: name should not contain the delimiter "${DELIMITER}"`)
|
}).toThrow(
|
||||||
|
`Unexpected input: name should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
const filePath = path.join(__dirname, `test/${command}`)
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
fs.unlinkSync(filePath)
|
fs.unlinkSync(filePath)
|
||||||
|
|
|
@ -91,11 +91,15 @@ export function exportVariable(name: string, val: any): void {
|
||||||
|
|
||||||
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
|
||||||
if (name.includes(delimiter)) {
|
if (name.includes(delimiter)) {
|
||||||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`)
|
throw new Error(
|
||||||
|
`Unexpected input: name should not contain the delimiter "${delimiter}"`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (convertedVal.includes(delimiter)) {
|
if (convertedVal.includes(delimiter)) {
|
||||||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`)
|
throw new Error(
|
||||||
|
`Unexpected input: value should not contain the delimiter "${delimiter}"`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`
|
||||||
|
|
Loading…
Reference in New Issue