Skip to content

Repository files navigation

English | 简体中文

GitHub Actions Workflow Status GitHub Release GitHub Repo stars GitHub commits since latest release GitHub code size in bytes

Run jq command in GitHub Actions and return process result.


Inputs

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.

Outputs

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

Examples

Basic usage

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

Complex usage

See test.yml file. The outputs are in actions.

About

Run jq command in GitHub Actions and return process result.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages