Add status to outputs (#147)

* Add status to outputs

* add response.status info to readme

* build new version
This commit is contained in:
Jeremy Turowetz 2024-05-04 00:59:04 -04:00 committed by GitHub
parent ed8a1c36db
commit 7d4a18ad25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 558 additions and 555 deletions

View file

@ -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

File diff suppressed because one or more lines are too long

View file

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