https://github.com/dovyski/payload-info-action
Github Action to extract info from the webhook payload object using jq filters.
https://github.com/dovyski/payload-info-action
extract extract-information github-action github-actions jq json payload webhook
Last synced: 9 months ago
JSON representation
Github Action to extract info from the webhook payload object using jq filters.
- Host: GitHub
- URL: https://github.com/dovyski/payload-info-action
- Owner: Dovyski
- License: mit
- Created: 2020-01-16T18:38:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T13:37:24.000Z (over 1 year ago)
- Last Synced: 2025-04-14T21:52:58.363Z (about 1 year ago)
- Topics: extract, extract-information, github-action, github-actions, jq, json, payload, webhook
- Language: JavaScript
- Homepage:
- Size: 2.5 MB
- Stars: 6
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Payload Info
This action extracts info from the webhook payload object in Github Actions using filters based on the `jq` tool. It also provides the name of the branch this workflow is running on and if it is a pull request or not.
Check out the [`.github/workflows/main.yml`](https://github.com/Dovyski/payload-info-action/blob/master/.github/workflows/main.yml) file to see this action working.
## Inputs
### `filter_push`
**Required** Filter to be applied to the webhook payload object in case of a push. Default `"."`.
Learn more about filters at the [jq manual](https://stedolan.github.io/jq/manual/#Basicfilters).
### `filter_pull_request`
Filter to be applied to the webhook payload object in case of a pull request. Default `".pull_request."`.
Learn more about filters at the [jq manual](https://stedolan.github.io/jq/manual/#Basicfilters).
### `filter_prefix`
String to be prefixed to all filters. Default `".[]"`.
### `dump`
If the webhook payload should be dumped as a JSON file or not. Default `true`.
### `dump_path`
Path to the JSON file that will house the dumped webhook payload. Default `"gh-payload.json"`.
### `print`
If the webhook payload should be output. Default `true`.
## Outputs
### `value`
Result of the filter applied to the webhook payload. If this the workflow is on a regular push (not pull request), `value` contains the result of the `filter_push` filter. If the workflow is on a pull request, `value` contains the result of the `filter_pull_request` filter.
### `branch`
Name of the branch related to this workflow, e.g. `"master"`.
### `pull_request`
If this workflow is running on a pull request or not, e.g. `"false"`.
## Example usage
```yml
- uses: Dovyski/payload-info-action@master
with:
filter_push: '.commits[].author'
filter_pull_request: '.pull_request.commits'
```