Compare commits
45
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a99da03c77 | ||
|
|
e0023baa89 | ||
|
|
17bd5c18e9 | ||
|
|
4b6dd2fbd0 | ||
|
|
d6c6f72a70 | ||
|
|
819157bf87 | ||
|
|
86102e88e9 | ||
|
|
e4c071ba19 | ||
|
|
9443e26349 | ||
|
|
5a0405df4e | ||
|
|
0e707aeabc | ||
|
|
7441dc5e59 | ||
|
|
1ddac5e02f | ||
|
|
55484166d8 | ||
|
|
7181b913f5 | ||
|
|
81cd5a5c2e | ||
|
|
4b348086a9 | ||
|
|
436cf8d6ea | ||
|
|
e0aadb573c | ||
|
|
62a66a8ce9 | ||
|
|
0c58e4113e | ||
|
|
9366237c90 | ||
|
|
b36e70495f | ||
|
|
8423354d7d | ||
|
|
abcca5a0b2 | ||
|
|
b2e1c39c92 | ||
|
|
8e8a93deae | ||
|
|
738c849e89 | ||
|
|
9b58167dc9 | ||
|
|
ffb7e3e14e | ||
|
|
ce378c4cec | ||
|
|
3e257b0745 | ||
|
|
e5e4491ac5 | ||
|
|
1bc93f3cdf | ||
|
|
4fbc5c941a | ||
|
|
ac778acad2 | ||
|
|
192c26f865 | ||
|
|
295cbcc4da | ||
|
|
b00a9fd033 | ||
|
|
4df45177e4 | ||
|
|
33f1d64363 | ||
|
|
ebe4ac336f | ||
|
|
94de2cf6d4 | ||
|
|
64c334f0e5 | ||
|
|
8b45e1e356 |
@@ -221,7 +221,7 @@ console.log(`We can even get context data, like the repo: ${context.repo.repo}`)
|
|||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We welcome contributions. See [how to contribute](.github/CONTRIBUTING.md).
|
We welcome contributions. See [how to contribute](.github/CONTRIBUTING.md).
|
||||||
|
hi
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
See [our code of conduct](CODE_OF_CONDUCT.md).
|
See [our code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> Functions necessary for caching dependencies and build outputs to improve workflow execution time.
|
> Functions necessary for caching dependencies and build outputs to improve workflow execution time.
|
||||||
|
|
||||||
See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows) for how caching works.
|
See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) for how caching works.
|
||||||
|
|
||||||
Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 10 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 10 GB.
|
Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 10 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 10 GB.
|
||||||
|
|
||||||
|
|||||||
Vendored
+7
-1
@@ -84,4 +84,10 @@
|
|||||||
|
|
||||||
### 3.0.4
|
### 3.0.4
|
||||||
- Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891).
|
- Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891).
|
||||||
- Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MIN`. Default is 60 minutes.
|
- Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes.
|
||||||
|
|
||||||
|
### 3.0.5
|
||||||
|
- Update `@actions/cache` to use `@actions/core@^1.10.0`
|
||||||
|
|
||||||
|
### 3.0.6
|
||||||
|
- Added `@azure/abort-controller` to dependencies to fix compatibility issue with ESM [#1208](https://github.com/actions/toolkit/issues/1208)
|
||||||
|
|||||||
+19
-18
@@ -1,19 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.4",
|
"version": "3.0.6",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.4",
|
"version": "3.0.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
"@actions/glob": "^0.1.0",
|
"@actions/glob": "^0.1.0",
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.1",
|
||||||
|
"@azure/abort-controller": "^1.1.0",
|
||||||
"@azure/ms-rest-js": "^2.6.0",
|
"@azure/ms-rest-js": "^2.6.0",
|
||||||
"@azure/storage-blob": "^12.8.0",
|
"@azure/storage-blob": "^12.8.0",
|
||||||
"semver": "^6.1.0",
|
"semver": "^6.1.0",
|
||||||
@@ -26,9 +27,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
@@ -73,14 +74,14 @@
|
|||||||
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
||||||
},
|
},
|
||||||
"node_modules/@azure/abort-controller": {
|
"node_modules/@azure/abort-controller": {
|
||||||
"version": "1.0.4",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
|
||||||
"integrity": "sha512-lNUmDRVGpanCsiUN3NWxFTdwmdFI53xwhkTFfHDGTYk46ca7Ind3nanJc+U6Zj9Tv+9nTCWRBscWEW1DyKOpTw==",
|
"integrity": "sha512-TrRLIoSQVzfAJX9H1JeFjzAoDGcoK1IYX1UImfceTZpsyYfWr09Ss1aHW1y5TrrR3iq6RZLBwJ3E24uwPhwahw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.0.0"
|
"node": ">=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@azure/abort-controller/node_modules/tslib": {
|
"node_modules/@azure/abort-controller/node_modules/tslib": {
|
||||||
@@ -617,9 +618,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
@@ -663,11 +664,11 @@
|
|||||||
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
"integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
|
||||||
},
|
},
|
||||||
"@azure/abort-controller": {
|
"@azure/abort-controller": {
|
||||||
"version": "1.0.4",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
|
||||||
"integrity": "sha512-lNUmDRVGpanCsiUN3NWxFTdwmdFI53xwhkTFfHDGTYk46ca7Ind3nanJc+U6Zj9Tv+9nTCWRBscWEW1DyKOpTw==",
|
"integrity": "sha512-TrRLIoSQVzfAJX9H1JeFjzAoDGcoK1IYX1UImfceTZpsyYfWr09Ss1aHW1y5TrrR3iq6RZLBwJ3E24uwPhwahw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": {
|
"tslib": {
|
||||||
|
|||||||
Vendored
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.0.4",
|
"version": "3.0.6",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -37,11 +37,12 @@
|
|||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
"@actions/glob": "^0.1.0",
|
"@actions/glob": "^0.1.0",
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.1",
|
||||||
|
"@azure/abort-controller": "^1.1.0",
|
||||||
"@azure/ms-rest-js": "^2.6.0",
|
"@azure/ms-rest-js": "^2.6.0",
|
||||||
"@azure/storage-blob": "^12.8.0",
|
"@azure/storage-blob": "^12.8.0",
|
||||||
"semver": "^6.1.0",
|
"semver": "^6.1.0",
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export interface AnnotationProperties {
|
|||||||
startColumn?: number
|
startColumn?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
* Defaults to `startColumn` when `startColumn` is provided.
|
||||||
*/
|
*/
|
||||||
endColumn?: number
|
endColumn?: number
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# @actions/core Releases
|
# @actions/core Releases
|
||||||
|
|
||||||
|
### 1.10.0
|
||||||
|
- `saveState` and `setOutput` now use environment files if available [#1178](https://github.com/actions/toolkit/pull/1178)
|
||||||
|
- `getMultilineInput` now correctly trims whitespace by default [#1185](https://github.com/actions/toolkit/pull/1185)
|
||||||
|
|
||||||
### 1.9.1
|
### 1.9.1
|
||||||
- Randomize delimiter when calling `core.exportVariable`
|
- Randomize delimiter when calling `core.exportVariable`
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,17 @@ const testEnvVars = {
|
|||||||
INPUT_BOOLEAN_INPUT_FALSE3: 'FALSE',
|
INPUT_BOOLEAN_INPUT_FALSE3: 'FALSE',
|
||||||
INPUT_WRONG_BOOLEAN_INPUT: 'wrong',
|
INPUT_WRONG_BOOLEAN_INPUT: 'wrong',
|
||||||
INPUT_WITH_TRAILING_WHITESPACE: ' some val ',
|
INPUT_WITH_TRAILING_WHITESPACE: ' some val ',
|
||||||
|
|
||||||
INPUT_MY_INPUT_LIST: 'val1\nval2\nval3',
|
INPUT_MY_INPUT_LIST: 'val1\nval2\nval3',
|
||||||
|
INPUT_LIST_WITH_TRAILING_WHITESPACE: ' val1 \n val2 \n ',
|
||||||
|
|
||||||
// Save inputs
|
// Save inputs
|
||||||
STATE_TEST_1: 'state_val',
|
STATE_TEST_1: 'state_val',
|
||||||
|
|
||||||
// File Commands
|
// File Commands
|
||||||
GITHUB_PATH: '',
|
GITHUB_PATH: '',
|
||||||
GITHUB_ENV: ''
|
GITHUB_ENV: '',
|
||||||
|
GITHUB_OUTPUT: '',
|
||||||
|
GITHUB_STATE: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const UUID = '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
const UUID = '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
||||||
@@ -212,14 +214,6 @@ describe('@actions/core', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('getMultilineInput works', () => {
|
|
||||||
expect(core.getMultilineInput('my input list')).toEqual([
|
|
||||||
'val1',
|
|
||||||
'val2',
|
|
||||||
'val3'
|
|
||||||
])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('getInput trims whitespace by default', () => {
|
it('getInput trims whitespace by default', () => {
|
||||||
expect(core.getInput('with trailing whitespace')).toBe('some val')
|
expect(core.getInput('with trailing whitespace')).toBe('some val')
|
||||||
})
|
})
|
||||||
@@ -260,7 +254,38 @@ describe('@actions/core', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setOutput produces the correct command', () => {
|
it('getMultilineInput works', () => {
|
||||||
|
expect(core.getMultilineInput('my input list')).toEqual([
|
||||||
|
'val1',
|
||||||
|
'val2',
|
||||||
|
'val3'
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('getMultilineInput trims whitespace by default', () => {
|
||||||
|
expect(core.getMultilineInput('list with trailing whitespace')).toEqual([
|
||||||
|
'val1',
|
||||||
|
'val2'
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('getMultilineInput trims whitespace when option is explicitly true', () => {
|
||||||
|
expect(
|
||||||
|
core.getMultilineInput('list with trailing whitespace', {
|
||||||
|
trimWhitespace: true
|
||||||
|
})
|
||||||
|
).toEqual(['val1', 'val2'])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('getMultilineInput does not trim whitespace when option is false', () => {
|
||||||
|
expect(
|
||||||
|
core.getMultilineInput('list with trailing whitespace', {
|
||||||
|
trimWhitespace: false
|
||||||
|
})
|
||||||
|
).toEqual([' val1 ', ' val2 ', ' '])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('legacy setOutput produces the correct command', () => {
|
||||||
core.setOutput('some output', 'some value')
|
core.setOutput('some output', 'some value')
|
||||||
assertWriteCalls([
|
assertWriteCalls([
|
||||||
os.EOL,
|
os.EOL,
|
||||||
@@ -268,16 +293,74 @@ describe('@actions/core', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setOutput handles bools', () => {
|
it('legacy setOutput handles bools', () => {
|
||||||
core.setOutput('some output', false)
|
core.setOutput('some output', false)
|
||||||
assertWriteCalls([os.EOL, `::set-output name=some output::false${os.EOL}`])
|
assertWriteCalls([os.EOL, `::set-output name=some output::false${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('setOutput handles numbers', () => {
|
it('legacy setOutput handles numbers', () => {
|
||||||
core.setOutput('some output', 1.01)
|
core.setOutput('some output', 1.01)
|
||||||
assertWriteCalls([os.EOL, `::set-output name=some output::1.01${os.EOL}`])
|
assertWriteCalls([os.EOL, `::set-output name=some output::1.01${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('setOutput produces the correct command and sets the output', () => {
|
||||||
|
const command = 'OUTPUT'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.setOutput('my out', 'out val')
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my out<<${DELIMITER}${os.EOL}out val${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('setOutput handles boolean inputs', () => {
|
||||||
|
const command = 'OUTPUT'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.setOutput('my out', true)
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my out<<${DELIMITER}${os.EOL}true${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('setOutput handles number inputs', () => {
|
||||||
|
const command = 'OUTPUT'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.setOutput('my out', 5)
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my out<<${DELIMITER}${os.EOL}5${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('setOutput does not allow delimiter as value', () => {
|
||||||
|
const command = 'OUTPUT'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
core.setOutput('my out', `good stuff ${DELIMITER} bad stuff`)
|
||||||
|
}).toThrow(
|
||||||
|
`Unexpected input: value should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
|
fs.unlinkSync(filePath)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('setOutput does not allow delimiter as name', () => {
|
||||||
|
const command = 'OUTPUT'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
core.setOutput(`good stuff ${DELIMITER} bad stuff`, 'test')
|
||||||
|
}).toThrow(
|
||||||
|
`Unexpected input: name should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
|
fs.unlinkSync(filePath)
|
||||||
|
})
|
||||||
|
|
||||||
it('setFailed sets the correct exit code and failure message', () => {
|
it('setFailed sets the correct exit code and failure message', () => {
|
||||||
core.setFailed('Failure message')
|
core.setFailed('Failure message')
|
||||||
expect(process.exitCode).toBe(core.ExitCode.Failure)
|
expect(process.exitCode).toBe(core.ExitCode.Failure)
|
||||||
@@ -443,21 +526,79 @@ describe('@actions/core', () => {
|
|||||||
assertWriteCalls([`::debug::%0D%0Adebug%0A${os.EOL}`])
|
assertWriteCalls([`::debug::%0D%0Adebug%0A${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('saveState produces the correct command', () => {
|
it('legacy saveState produces the correct command', () => {
|
||||||
core.saveState('state_1', 'some value')
|
core.saveState('state_1', 'some value')
|
||||||
assertWriteCalls([`::save-state name=state_1::some value${os.EOL}`])
|
assertWriteCalls([`::save-state name=state_1::some value${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('saveState handles numbers', () => {
|
it('legacy saveState handles numbers', () => {
|
||||||
core.saveState('state_1', 1)
|
core.saveState('state_1', 1)
|
||||||
assertWriteCalls([`::save-state name=state_1::1${os.EOL}`])
|
assertWriteCalls([`::save-state name=state_1::1${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('saveState handles bools', () => {
|
it('legacy saveState handles bools', () => {
|
||||||
core.saveState('state_1', true)
|
core.saveState('state_1', true)
|
||||||
assertWriteCalls([`::save-state name=state_1::true${os.EOL}`])
|
assertWriteCalls([`::save-state name=state_1::true${os.EOL}`])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('saveState produces the correct command and saves the state', () => {
|
||||||
|
const command = 'STATE'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.saveState('my state', 'out val')
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my state<<${DELIMITER}${os.EOL}out val${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('saveState handles boolean inputs', () => {
|
||||||
|
const command = 'STATE'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.saveState('my state', true)
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my state<<${DELIMITER}${os.EOL}true${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('saveState handles number inputs', () => {
|
||||||
|
const command = 'STATE'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
core.saveState('my state', 5)
|
||||||
|
verifyFileCommand(
|
||||||
|
command,
|
||||||
|
`my state<<${DELIMITER}${os.EOL}5${os.EOL}${DELIMITER}${os.EOL}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('saveState does not allow delimiter as value', () => {
|
||||||
|
const command = 'STATE'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
core.saveState('my state', `good stuff ${DELIMITER} bad stuff`)
|
||||||
|
}).toThrow(
|
||||||
|
`Unexpected input: value should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
|
fs.unlinkSync(filePath)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('saveState does not allow delimiter as name', () => {
|
||||||
|
const command = 'STATE'
|
||||||
|
createFileCommandFile(command)
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
core.saveState(`good stuff ${DELIMITER} bad stuff`, 'test')
|
||||||
|
}).toThrow(
|
||||||
|
`Unexpected input: name should not contain the delimiter "${DELIMITER}"`
|
||||||
|
)
|
||||||
|
|
||||||
|
const filePath = path.join(__dirname, `test/${command}`)
|
||||||
|
fs.unlinkSync(filePath)
|
||||||
|
})
|
||||||
|
|
||||||
it('getState gets wrapper action state', () => {
|
it('getState gets wrapper action state', () => {
|
||||||
expect(core.getState('TEST_1')).toBe('state_val')
|
expect(core.getState('TEST_1')).toBe('state_val')
|
||||||
})
|
})
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|||||||
+19
-22
@@ -1,10 +1,9 @@
|
|||||||
import {issue, issueCommand} from './command'
|
import {issue, issueCommand} from './command'
|
||||||
import {issueCommand as issueFileCommand} from './file-command'
|
import {issueFileCommand, prepareKeyValueMessage} from './file-command'
|
||||||
import {toCommandProperties, toCommandValue} from './utils'
|
import {toCommandProperties, toCommandValue} from './utils'
|
||||||
|
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import {v4 as uuidv4} from 'uuid'
|
|
||||||
|
|
||||||
import {OidcClient} from './oidc-utils'
|
import {OidcClient} from './oidc-utils'
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ export interface AnnotationProperties {
|
|||||||
startColumn?: number
|
startColumn?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||||
* Defaults to `startColumn` when `startColumn` is provided.
|
* Defaults to `startColumn` when `startColumn` is provided.
|
||||||
*/
|
*/
|
||||||
endColumn?: number
|
endColumn?: number
|
||||||
@@ -87,26 +86,10 @@ export function exportVariable(name: string, val: any): void {
|
|||||||
|
|
||||||
const filePath = process.env['GITHUB_ENV'] || ''
|
const filePath = process.env['GITHUB_ENV'] || ''
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
const delimiter = `ghadelimiter_${uuidv4()}`
|
return issueFileCommand('ENV', prepareKeyValueMessage(name, val))
|
||||||
|
|
||||||
// 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)) {
|
|
||||||
throw new Error(
|
|
||||||
`Unexpected input: name should not contain the delimiter "${delimiter}"`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (convertedVal.includes(delimiter)) {
|
|
||||||
throw new Error(
|
|
||||||
`Unexpected input: value should not contain the delimiter "${delimiter}"`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`
|
|
||||||
issueFileCommand('ENV', commandValue)
|
|
||||||
} else {
|
|
||||||
issueCommand('set-env', {name}, convertedVal)
|
issueCommand('set-env', {name}, convertedVal)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +153,11 @@ export function getMultilineInput(
|
|||||||
.split('\n')
|
.split('\n')
|
||||||
.filter(x => x !== '')
|
.filter(x => x !== '')
|
||||||
|
|
||||||
|
if (options && options.trimWhitespace === false) {
|
||||||
return inputs
|
return inputs
|
||||||
|
}
|
||||||
|
|
||||||
|
return inputs.map(input => input.trim())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,8 +190,13 @@ export function getBooleanInput(name: string, options?: InputOptions): boolean {
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function setOutput(name: string, value: any): void {
|
export function setOutput(name: string, value: any): void {
|
||||||
|
const filePath = process.env['GITHUB_OUTPUT'] || ''
|
||||||
|
if (filePath) {
|
||||||
|
return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value))
|
||||||
|
}
|
||||||
|
|
||||||
process.stdout.write(os.EOL)
|
process.stdout.write(os.EOL)
|
||||||
issueCommand('set-output', {name}, value)
|
issueCommand('set-output', {name}, toCommandValue(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -358,7 +350,12 @@ export async function group<T>(name: string, fn: () => Promise<T>): Promise<T> {
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
export function saveState(name: string, value: any): void {
|
export function saveState(name: string, value: any): void {
|
||||||
issueCommand('save-state', {name}, value)
|
const filePath = process.env['GITHUB_STATE'] || ''
|
||||||
|
if (filePath) {
|
||||||
|
return issueFileCommand('STATE', prepareKeyValueMessage(name, value))
|
||||||
|
}
|
||||||
|
|
||||||
|
issueCommand('save-state', {name}, toCommandValue(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
|
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
|
import {v4 as uuidv4} from 'uuid'
|
||||||
import {toCommandValue} from './utils'
|
import {toCommandValue} from './utils'
|
||||||
|
|
||||||
export function issueCommand(command: string, message: any): void {
|
export function issueFileCommand(command: string, message: any): void {
|
||||||
const filePath = process.env[`GITHUB_${command}`]
|
const filePath = process.env[`GITHUB_${command}`]
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -22,3 +23,25 @@ export function issueCommand(command: string, message: any): void {
|
|||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function prepareKeyValueMessage(key: string, value: any): string {
|
||||||
|
const delimiter = `ghadelimiter_${uuidv4()}`
|
||||||
|
const convertedValue = toCommandValue(value)
|
||||||
|
|
||||||
|
// 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 (key.includes(delimiter)) {
|
||||||
|
throw new Error(
|
||||||
|
`Unexpected input: name should not contain the delimiter "${delimiter}"`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (convertedValue.includes(delimiter)) {
|
||||||
|
throw new Error(
|
||||||
|
`Unexpected input: value should not contain the delimiter "${delimiter}"`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# @actions/github Releases
|
# @actions/github Releases
|
||||||
|
|
||||||
|
### 5.1.1
|
||||||
|
- Export default octokit options [#1188](https://github.com/actions/toolkit/pull/1188)
|
||||||
|
|
||||||
|
### 5.1.0
|
||||||
|
- Add additionalPlugins parameter to getOctokit method [#1181](https://github.com/actions/toolkit/pull/1181)
|
||||||
|
- Dependency updates [#1180](https://github.com/actions/toolkit/pull/1180)
|
||||||
|
|
||||||
|
|
||||||
### 5.0.3
|
### 5.0.3
|
||||||
- - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087)
|
- - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087)
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"version": "5.0.3",
|
"version": "5.1.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"version": "5.0.3",
|
"version": "5.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"version": "5.0.3",
|
"version": "5.1.1",
|
||||||
"description": "Actions github lib",
|
"description": "Actions github lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as Context from './context'
|
|||||||
import {GitHub, getOctokitOptions} from './utils'
|
import {GitHub, getOctokitOptions} from './utils'
|
||||||
|
|
||||||
// octokit + plugins
|
// octokit + plugins
|
||||||
import {OctokitOptions} from '@octokit/core/dist-types/types'
|
import {OctokitOptions, OctokitPlugin} from '@octokit/core/dist-types/types'
|
||||||
|
|
||||||
export const context = new Context.Context()
|
export const context = new Context.Context()
|
||||||
|
|
||||||
@@ -14,7 +14,9 @@ export const context = new Context.Context()
|
|||||||
*/
|
*/
|
||||||
export function getOctokit(
|
export function getOctokit(
|
||||||
token: string,
|
token: string,
|
||||||
options?: OctokitOptions
|
options?: OctokitOptions,
|
||||||
|
...additionalPlugins: OctokitPlugin[]
|
||||||
): InstanceType<typeof GitHub> {
|
): InstanceType<typeof GitHub> {
|
||||||
return new GitHub(getOctokitOptions(token, options))
|
const GitHubWithPlugins = GitHub.plugin(...additionalPlugins)
|
||||||
|
return new GitHubWithPlugins(getOctokitOptions(token, options))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {paginateRest} from '@octokit/plugin-paginate-rest'
|
|||||||
export const context = new Context.Context()
|
export const context = new Context.Context()
|
||||||
|
|
||||||
const baseUrl = Utils.getApiBaseUrl()
|
const baseUrl = Utils.getApiBaseUrl()
|
||||||
const defaults = {
|
export const defaults: OctokitOptions = {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
request: {
|
request: {
|
||||||
agent: Utils.getProxyAgent(baseUrl)
|
agent: Utils.getProxyAgent(baseUrl)
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/io",
|
"name": "@actions/io",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"description": "Actions io lib",
|
"description": "Actions io lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|||||||
+12
-3
@@ -4,7 +4,8 @@ import * as path from 'path'
|
|||||||
import {promisify} from 'util'
|
import {promisify} from 'util'
|
||||||
import * as ioUtil from './io-util'
|
import * as ioUtil from './io-util'
|
||||||
|
|
||||||
const exec = promisify(childProcess.exec)
|
// const exec = promisify(childProcess.exec)
|
||||||
|
// const fork = promisify(childProcess.fork)
|
||||||
const execFile = promisify(childProcess.execFile)
|
const execFile = promisify(childProcess.execFile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,12 +130,20 @@ export async function rmRF(inputPath: string): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
const cmdPath = ioUtil.getCmdPath()
|
const cmdPath = ioUtil.getCmdPath()
|
||||||
if (await ioUtil.isDirectory(inputPath, true)) {
|
if (await ioUtil.isDirectory(inputPath, true)) {
|
||||||
await exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
await execFile(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||||
env: {inputPath}
|
env: {inputPath}
|
||||||
|
}).catch(err => {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT') throw err
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
await exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
await execFile(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||||
env: {inputPath}
|
env: {inputPath}
|
||||||
|
}).catch(err => {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT') throw err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user