mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2026-02-05 00:55:52 +08:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74e0e96181 | ||
|
|
2bb8059d00 | ||
|
|
bfbe4dd6af | ||
|
|
7c708e96af | ||
|
|
f9dc1a8d4b | ||
|
|
33a4d079d7 | ||
|
|
0b6ec5eadd | ||
|
|
897b6a3c96 | ||
|
|
363da44e0a | ||
|
|
1a131d17cc | ||
|
|
72a0a5b93e | ||
|
|
606bb16fb9 | ||
|
|
517601f732 | ||
|
|
c9a231b621 | ||
|
|
2e6550f5bd | ||
|
|
caab55e3d8 | ||
|
|
997aeb8de8 | ||
|
|
0bd00a33db | ||
|
|
a665541d9c | ||
|
|
e23645bd9b | ||
|
|
897543ff26 | ||
|
|
3fee944184 | ||
|
|
c23f0d6631 | ||
|
|
6dd87961de |
@@ -45,6 +45,7 @@ jobs:
|
|||||||
|httpsCert| Client Certificate as string ||
|
|httpsCert| Client Certificate as string ||
|
||||||
|httpsKey| Client Certificate Key as string ||
|
|httpsKey| Client Certificate Key as string ||
|
||||||
|responseFile| Persist the response data to the specified file path ||
|
|responseFile| Persist the response data to the specified file path ||
|
||||||
|
|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 ||
|
|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 |
|
|retryWait| time between each retry in millseconds | 3000 |
|
||||||
|
|
||||||
@@ -99,4 +100,4 @@ Optionen:
|
|||||||
--bearerToken bearer token without Bearer prefix, added as
|
--bearerToken bearer token without Bearer prefix, added as
|
||||||
Authorization header [string]
|
Authorization header [string]
|
||||||
--timeout request timeout [number] [default: 5000]
|
--timeout request timeout [number] [default: 5000]
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ inputs:
|
|||||||
description: 'Auth Password'
|
description: 'Auth Password'
|
||||||
required: false
|
required: false
|
||||||
timeout:
|
timeout:
|
||||||
description: 'Request Timeout in Sec'
|
description: 'Request Timeout in milliseconds'
|
||||||
required: false
|
required: false
|
||||||
default: '5000'
|
default: '5000'
|
||||||
bearerToken:
|
bearerToken:
|
||||||
@@ -75,5 +75,5 @@ outputs:
|
|||||||
headers:
|
headers:
|
||||||
description: 'HTTP Response Headers'
|
description: 'HTTP Response Headers'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
1460
dist/index.js
vendored
1460
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
24
package-lock.json
generated
24
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "http-request-action",
|
"name": "http-request-action",
|
||||||
"version": "1.14.1",
|
"version": "1.14.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "http-request-action",
|
"name": "http-request-action",
|
||||||
"version": "1.14.1",
|
"version": "1.14.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1"
|
"@actions/core": "^1.10.1"
|
||||||
@@ -87,12 +87,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.8",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
||||||
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
|
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.0",
|
"follow-redirects": "^1.15.6",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"proxy-from-env": "^1.1.0"
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
@@ -166,9 +166,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/follow-redirects": {
|
"node_modules/follow-redirects": {
|
||||||
"version": "1.15.3",
|
"version": "1.15.6",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -288,9 +288,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "5.27.2",
|
"version": "5.28.4",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.27.2.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
|
||||||
"integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==",
|
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/busboy": "^2.0.0"
|
"@fastify/busboy": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,13 +9,7 @@ const { GithubActions } = require('../githubActions');
|
|||||||
* @returns {(response: axios.AxiosResponse) => void}
|
* @returns {(response: axios.AxiosResponse) => void}
|
||||||
*/
|
*/
|
||||||
const createMaskHandler = (actions) => (response) => {
|
const createMaskHandler = (actions) => (response) => {
|
||||||
let data = response.data
|
actions.setSecret(JSON.stringify(response.data))
|
||||||
|
|
||||||
if (typeof data == 'object') {
|
|
||||||
data = JSON.stringify(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
actions.setSecret(data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { createMaskHandler }
|
module.exports = { createMaskHandler }
|
||||||
@@ -9,7 +9,7 @@ const { GithubActions } = require('../githubActions');
|
|||||||
* @returns {(response: axios.AxiosResponse) => void}
|
* @returns {(response: axios.AxiosResponse) => void}
|
||||||
*/
|
*/
|
||||||
const createOutputHandler = (actions) => (response) => {
|
const createOutputHandler = (actions) => (response) => {
|
||||||
actions.setOutput('response', response.data)
|
actions.setOutput('response', JSON.stringify(response.data))
|
||||||
actions.setOutput('headers', response.headers)
|
actions.setOutput('headers', response.headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const retry = async (callback, options) => {
|
|||||||
lastErr = err;
|
lastErr = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < options.retries) {
|
if (i < options.retry) {
|
||||||
options.actions.warning(`#${i + 1} request failed: ${err}`);
|
options.actions.warning(`#${i + 1} request failed: ${err}`);
|
||||||
await sleep(options.sleep);
|
await sleep(options.sleep);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
|
|||||||
} catch(error) {
|
} catch(error) {
|
||||||
if (error.response && options.ignoredCodes.includes(error.response.status)) {
|
if (error.response && options.ignoredCodes.includes(error.response.status)) {
|
||||||
actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`)
|
actions.warning(`ignored status code: ${JSON.stringify({ code: error.response.status, message: error.response.data })}`)
|
||||||
|
|
||||||
return null
|
return error.response
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!error.response && error.request && options.preventFailureOnNoResponse) {
|
if (!error.response && error.request && options.preventFailureOnNoResponse) {
|
||||||
actions.warning(`no response received: ${JSON.stringify(error)}`);
|
actions.warning(`no response received: ${JSON.stringify(error)}`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user