mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2026-02-04 16:45:52 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea4657059 | ||
|
|
ae65a272d9 | ||
|
|
6cbe966de9 | ||
|
|
1e440b8b8c | ||
|
|
7d4a18ad25 | ||
|
|
ed8a1c36db |
@@ -48,6 +48,7 @@ jobs:
|
||||
|maskResponse| If set to true, the response will be masked in the logs of the action |'false'|
|
||||
|retry| optional amount of retries if the request is failing, does not retry if the status code is ignored ||
|
||||
|retryWait| time between each retry in millseconds | 3000 |
|
||||
|ignoreSsl| ignore ssl verify (rejectUnauthorized: false) | false |
|
||||
|
||||
### Response
|
||||
|
||||
@@ -55,6 +56,7 @@ jobs:
|
||||
|---|---|
|
||||
`response` | Response as JSON String
|
||||
`headers` | Headers
|
||||
`status` | HTTP status message
|
||||
|
||||
To display HTTP response data in the GitHub Actions log give the request an `id` and access its `outputs`. You can also access specific field from the response data using [fromJson()](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson) expression.
|
||||
|
||||
@@ -69,6 +71,7 @@ steps:
|
||||
run: |
|
||||
echo ${{ steps.myRequest.outputs.response }}
|
||||
echo ${{ steps.myRequest.outputs.headers }}
|
||||
echo ${{ steps.myRequest.outputs.status }}
|
||||
echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }}
|
||||
```
|
||||
|
||||
|
||||
@@ -69,11 +69,16 @@ inputs:
|
||||
retryWait:
|
||||
description: 'wait time between retries in milliseconds'
|
||||
required: false
|
||||
ignoreSsl:
|
||||
description: 'ignore ssl verify (rejectUnauthorized: false)'
|
||||
default: 'false'
|
||||
outputs:
|
||||
response:
|
||||
description: 'HTTP Response Content'
|
||||
headers:
|
||||
description: 'HTTP Response Headers'
|
||||
status:
|
||||
description: 'HTTP status message'
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
||||
849
dist/index.js
vendored
849
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
8
package-lock.json
generated
8
package-lock.json
generated
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"axios": "^1.6",
|
||||
"axios": "^1.7",
|
||||
"form-data": "^4.0.0",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
@@ -87,9 +87,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.6.8",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
||||
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
|
||||
"integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"homepage": "https://github.com/fjogeleit/http-request-action#readme",
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"axios": "^1.6",
|
||||
"axios": "^1.7",
|
||||
"form-data": "^4.0.0",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ const { GithubActions } = require('../githubActions');
|
||||
const createOutputHandler = (actions) => (response) => {
|
||||
actions.setOutput('response', JSON.stringify(response.data))
|
||||
actions.setOutput('headers', response.headers)
|
||||
actions.setOutput('status', response.status)
|
||||
}
|
||||
|
||||
module.exports = { createOutputHandler }
|
||||
module.exports = { createOutputHandler }
|
||||
|
||||
@@ -29,6 +29,9 @@ if (!!core.getInput('bearerToken')) {
|
||||
|
||||
/** @type {axios.AxiosRequestConfig} */
|
||||
const instanceConfig = {
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
|
||||
}),
|
||||
baseURL: core.getInput('url', { required: true }),
|
||||
timeout: parseInt(core.getInput('timeout') || 5000, 10),
|
||||
headers: { ...headers, ...customHeaders }
|
||||
@@ -102,4 +105,4 @@ request({ data, method, instanceConfig, files, file, actions, options }).then(re
|
||||
if (response && typeof response == 'object') {
|
||||
handler.forEach(h => h(response))
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user