1
0
Fork 0
mirror of https://github.com/fjogeleit/http-request-action.git synced 2024-12-23 04:37:28 +00:00

docs: enhance README.md

This commit is contained in:
Jinu Noh 2022-05-24 19:22:08 +09:00 committed by GitHub
parent 35336be18d
commit 435fe1dbc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,8 @@ jobs:
method: 'POST' method: 'POST'
username: ${{ secrets.AWX_USER }} username: ${{ secrets.AWX_USER }}
password: ${{ secrets.AWX_PASSWORD }} password: ${{ secrets.AWX_PASSWORD }}
customHeaders: '{"Authorization": "Bearer ${{ secrets.TOKEN }}", "Content-Type": "application/json"}'
data: '{"key_1": "value_1", "key_2": "value_2"}'
``` ```
### Versioning ### Versioning
@ -46,7 +48,7 @@ jobs:
|---|---| |---|---|
`response` | Response as JSON String `response` | Response as JSON String
To display HTTP response data in the GitHub Actions log give the request an `id` and access its `outputs` 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.
```yaml ```yaml
steps: steps:
@ -56,7 +58,9 @@ steps:
with: with:
url: "http://yoursite.com/api" url: "http://yoursite.com/api"
- name: Show Response - name: Show Response
run: echo ${{ steps.myRequest.outputs.response }} run: |
echo ${{ steps.myRequest.outputs.response }}
echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }}
``` ```
### Additional Information ### Additional Information