Skip to content

This lets you do jq operations in GitHub Actions.

License

Notifications You must be signed in to change notification settings

norman-zon/jq-action

This branch is 4 commits behind sergeysova/jq-action:master.

Folders and files

NameName
Last commit message
Last commit date
May 6, 2020
May 6, 2020
May 6, 2020
May 6, 2020
May 6, 2020
Dec 23, 2021
Dec 23, 2021
May 6, 2020
Apr 28, 2022
May 6, 2020
May 6, 2020

Repository files navigation

Run jq

Run jq on your data and get result as output

Inputs

cmd

Required This is the actual command that will be passed along

multiline

Optional. Default false.

Value Behavior
true Multiple lines of output will be captured. Useful for capturing lists.
false Only the first line of the output will be captured. The rest will be written to stdout.

Outputs

value

This is the actual result of the command executing

Example usage

uses: sergeysova/jq-action@v2
with:
  cmd: jq -n env

Using output

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    
      - name: Extract version from package.json
        uses: sergeysova/jq-action@v2
        id: version
        with:
          cmd: 'jq .version package.json -r'
      
      - name: Show my version
        run: 'echo "version ${{ steps.version.outputs.value }}"'

Using multiline output

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    
      - name: Extract all keywords from package.json
        uses: sergeysova/jq-action@v2
        id: keywords
        with:
          cmd: 'jq .keywords[] package.json -r'
          multiline: true
      
      - name: Show keywords
        run: |
          keywords="${{ steps.keywords.outputs.value }}"
          for keyword in $keywords; do
            echo "$keyword"
          done

About

This lets you do jq operations in GitHub Actions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 93.0%
  • Dockerfile 7.0%