mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2026-02-05 00:55:52 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea4657059 | ||
|
|
ae65a272d9 | ||
|
|
6cbe966de9 | ||
|
|
1e440b8b8c | ||
|
|
7d4a18ad25 |
@@ -56,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.
|
||||||
|
|
||||||
@@ -70,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 }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ outputs:
|
|||||||
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: 'node20'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
1951
dist/index.js
vendored
1951
dist/index.js
vendored
File diff suppressed because one or more lines are too long
8
package-lock.json
generated
8
package-lock.json
generated
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"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,9 +87,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.6.8",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
|
||||||
"integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
|
"integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.6",
|
"follow-redirects": "^1.15.6",
|
||||||
|
|||||||
@@ -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"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|||||||
Reference in New Issue
Block a user