mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-11-26 22:00:55 -05:00
Add status to outputs (#147)
* Add status to outputs * add response.status info to readme * build new version
This commit is contained in:
parent
ed8a1c36db
commit
7d4a18ad25
3 changed files with 558 additions and 555 deletions
|
@ -56,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.
|
||||
|
||||
|
@ -70,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 }}
|
||||
```
|
||||
|
||||
|
|
1108
dist/index.js
vendored
1108
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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 }
|
Loading…
Reference in a new issue