Skip to main content

GitHub Action: jq

Process a input with a jq script and output result as step output

Usage

  name: Pull Request
on:
pull_request:
branches: [ 'main' ]
types: [opened, synchronize, reopened, closed, labeled, unlabeled]

jobs:
example:
outputs:
result: "${{ steps.current.outputs.output }}"
steps:
- uses: cloudposse/github-action-jq@main
id: current
with:
compact: true
input: '["test", "test2", "test3"]'
script: |-
map(select(. == "test"))

Inputs

NameDescriptionDefaultRequired
compactCompact instead of pretty-printed outputfalsefalse
inputJSON file or JSON formatted stringN/Atrue
raw-outputOutput raw strings, not JSON textsfalsefalse
remove-trailing-newlineRemove trailing newlinetruefalse
scriptJQ query stringN/Atrue

Outputs

NameDescription
outputOutput from the jq command