English | 简体中文
Run jq command in GitHub Actions and return process result.
| Name | Required | Type | Default | Description |
|---|---|---|---|---|
data |
✅ Yes | string | - | The JSON file path or JSON string to be processed |
filter |
✅ Yes | string | - | jq filter expression, see jq documentation |
raw |
❌ No | boolean | true |
Raw output mode. Set to true to return non-JSON string(with -r symbol) |
options |
❌ No | string | - | The options to jq command. see jq options |
Tip
When you need to pass --null-input option, please set data parameter to 'null'. Then you don't need to pass --null-input option.
| Name | Description | Type |
|---|---|---|
result |
The result of jq command, output as-is(single line or multiline) | String |
multiline |
Whether the result of jq command is multiline | true/false |
name: Process JSON
on: [push]
jobs:
process:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Run jq
uses: emptylight370/jq-action@v1
id: version
with:
data: "package.json"
filter: ".version"
- name: Output
run: echo "Version is ${{ steps.version.outputs.result }}"