Compare commits

...

29 Commits

Author SHA1 Message Date
Frank Jogeleit
dea4657059 dep update
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2024-05-31 10:57:30 +02:00
Kurt Bonheure
ae65a272d9 Update action.yml (#151)
Added status as output in action.yml
2024-05-30 16:11:49 +02:00
dependabot[bot]
6cbe966de9 Bump axios from 1.7.1 to 1.7.2 (#149)
Bumps [axios](https://github.com/axios/axios) from 1.7.1 to 1.7.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.7.1...v1.7.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-27 20:08:58 +02:00
dependabot[bot]
1e440b8b8c Bump axios from 1.6.8 to 1.7.1 (#148)
Bumps [axios](https://github.com/axios/axios) from 1.6.8 to 1.7.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.8...v1.7.1)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-20 23:09:55 +02:00
Jeremy Turowetz
7d4a18ad25 Add status to outputs (#147)
* Add status to outputs

* add response.status info to readme

* build new version
2024-05-04 06:59:04 +02:00
Kittizz
ed8a1c36db Add ignore ssl error (#145)
* add ignore ssl
* build and update docs
* keep the upstream formatting/indentation
2024-04-20 14:34:12 +02:00
Frank Jogeleit
8af2803109 Merge pull request #144 from fjogeleit/fix-retryWait
fix retryWait mapping
2024-04-06 13:26:11 +02:00
Frank Jogeleit
8537e58734 fix retryWait mapping
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2024-04-06 13:22:18 +02:00
Frank Jogeleit
74e0e96181 update build
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2024-04-06 10:17:23 +02:00
Frank Jogeleit
2bb8059d00 Merge pull request #143 from fjogeleit/fixes
fix retry and ignore status response
2024-04-06 10:03:47 +02:00
Frank Jogeleit
bfbe4dd6af fix retry and ignore status response
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2024-04-06 09:53:11 +02:00
Frank Jogeleit
7c708e96af Merge pull request #139 from fjogeleit/dependabot/npm_and_yarn/undici-5.28.4
Bump undici from 5.28.3 to 5.28.4
2024-04-04 20:09:54 +02:00
dependabot[bot]
f9dc1a8d4b Bump undici from 5.28.3 to 5.28.4
Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-04 17:19:56 +00:00
Frank Jogeleit
33a4d079d7 Merge pull request #138 from fjogeleit/dependabot/npm_and_yarn/axios-1.6.8
Bump axios from 1.6.7 to 1.6.8
2024-03-19 07:51:06 +01:00
dependabot[bot]
0b6ec5eadd Bump axios from 1.6.7 to 1.6.8
Bumps [axios](https://github.com/axios/axios) from 1.6.7 to 1.6.8.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.7...v1.6.8)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 17:37:38 +00:00
Frank Jogeleit
897b6a3c96 Merge pull request #137 from fjogeleit/dependabot/npm_and_yarn/follow-redirects-1.15.6
Bump follow-redirects from 1.15.4 to 1.15.6
2024-03-17 07:07:59 +01:00
dependabot[bot]
363da44e0a Bump follow-redirects from 1.15.4 to 1.15.6
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-16 22:35:08 +00:00
Frank Jogeleit
1a131d17cc Merge pull request #136 from ClayenKitten/patch-1
docs: wrong `timeout` input description
2024-03-16 16:38:44 +01:00
ClayenKitten
72a0a5b93e docs: wrong timeout input description 2024-03-16 18:35:51 +03:00
Frank Jogeleit
606bb16fb9 Merge pull request #135 from fjogeleit/dependabot/npm_and_yarn/undici-5.28.3
Bump undici from 5.28.2 to 5.28.3
2024-02-16 21:30:45 +01:00
dependabot[bot]
517601f732 Bump undici from 5.28.2 to 5.28.3
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-16 18:40:16 +00:00
Frank Jogeleit
c9a231b621 Merge pull request #134 from fjogeleit/dependabot/npm_and_yarn/axios-1.6.7
Bump axios from 1.6.5 to 1.6.7
2024-01-29 18:48:27 +01:00
dependabot[bot]
2e6550f5bd Bump axios from 1.6.5 to 1.6.7
Bumps [axios](https://github.com/axios/axios) from 1.6.5 to 1.6.7.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.5...v1.6.7)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 17:04:46 +00:00
Frank Jogeleit
caab55e3d8 Merge pull request #132 from rgb2hsl/patch-1
Typo fix in README.md
2024-01-12 08:17:04 +01:00
Eugene
997aeb8de8 typo fix in README.md 2024-01-12 02:27:14 +04:00
Frank Jogeleit
0bd00a33db Merge pull request #131 from fjogeleit/node-upgrade
Upgrade to Node20
2024-01-08 14:43:30 +01:00
Frank Jogeleit
a665541d9c Upgrade to Node20
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
2024-01-08 14:40:25 +01:00
Frank Jogeleit
e23645bd9b Merge pull request #128 from fjogeleit/dependabot/npm_and_yarn/axios-1.6.3
Bump axios from 1.6.2 to 1.6.3
2024-01-01 19:08:53 +01:00
dependabot[bot]
897543ff26 Bump axios from 1.6.2 to 1.6.3
Bumps [axios](https://github.com/axios/axios) from 1.6.2 to 1.6.3.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.2...v1.6.3)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 17:03:36 +00:00
9 changed files with 1725 additions and 620 deletions

View File

@@ -45,9 +45,10 @@ 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 ||
|markResponse| If set to true, the response will be masked in the logs of the action |'false'| |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 |
|ignoreSsl| ignore ssl verify (rejectUnauthorized: false) | false |
### Response ### Response
@@ -55,6 +56,7 @@ jobs:
|---|---| |---|---|
`response` | Response as JSON String `response` | Response as JSON String
`headers` | Headers `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. 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: | run: |
echo ${{ steps.myRequest.outputs.response }} echo ${{ steps.myRequest.outputs.response }}
echo ${{ steps.myRequest.outputs.headers }} echo ${{ steps.myRequest.outputs.headers }}
echo ${{ steps.myRequest.outputs.status }}
echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }} echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }}
``` ```

View File

@@ -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:
@@ -69,11 +69,16 @@ inputs:
retryWait: retryWait:
description: 'wait time between retries in milliseconds' description: 'wait time between retries in milliseconds'
required: false required: false
ignoreSsl:
description: 'ignore ssl verify (rejectUnauthorized: false)'
default: 'false'
outputs: outputs:
response: response:
description: 'HTTP Response Content' description: 'HTTP Response Content'
headers: headers:
description: 'HTTP Response Headers' description: 'HTTP Response Headers'
status:
description: 'HTTP status message'
runs: runs:
using: 'node16' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'

2247
dist/index.js vendored

File diff suppressed because it is too large Load Diff

26
package-lock.json generated
View File

@@ -1,19 +1,19 @@
{ {
"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"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"axios": "^1.6", "axios": "^1.7",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"yargs": "^17.7.2" "yargs": "^17.7.2"
}, },
@@ -87,12 +87,12 @@
"dev": true "dev": true
}, },
"node_modules/axios": { "node_modules/axios": {
"version": "1.6.2", "version": "1.7.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
"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"
}, },

View File

@@ -20,7 +20,7 @@
"homepage": "https://github.com/fjogeleit/http-request-action#readme", "homepage": "https://github.com/fjogeleit/http-request-action#readme",
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"axios": "^1.6", "axios": "^1.7",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"yargs": "^17.7.2" "yargs": "^17.7.2"
}, },

View File

@@ -11,6 +11,7 @@ const { GithubActions } = require('../githubActions');
const createOutputHandler = (actions) => (response) => { const createOutputHandler = (actions) => (response) => {
actions.setOutput('response', JSON.stringify(response.data)) actions.setOutput('response', JSON.stringify(response.data))
actions.setOutput('headers', response.headers) actions.setOutput('headers', response.headers)
actions.setOutput('status', response.status)
} }
module.exports = { createOutputHandler } module.exports = { createOutputHandler }

View File

@@ -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);
} }

View File

@@ -95,7 +95,7 @@ const request = async({ method, instanceConfig, data, files, file, actions, opti
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) {

View File

@@ -29,6 +29,9 @@ if (!!core.getInput('bearerToken')) {
/** @type {axios.AxiosRequestConfig} */ /** @type {axios.AxiosRequestConfig} */
const instanceConfig = { const instanceConfig = {
httpsAgent: new https.Agent({
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
}),
baseURL: core.getInput('url', { required: true }), baseURL: core.getInput('url', { required: true }),
timeout: parseInt(core.getInput('timeout') || 5000, 10), timeout: parseInt(core.getInput('timeout') || 5000, 10),
headers: { ...headers, ...customHeaders } headers: { ...headers, ...customHeaders }
@@ -58,7 +61,7 @@ if (!!core.getInput('retry')) {
let retryWait = 3000 let retryWait = 3000
if (!!core.getInput('retryWait')) { if (!!core.getInput('retryWait')) {
retry = parseInt(core.getInput('retryWait')) retryWait = parseInt(core.getInput('retryWait'))
} }
const data = core.getInput('data') || '{}'; const data = core.getInput('data') || '{}';