This lets you do jq operations in GitHub Actions.
  • Shell 93%
  • Dockerfile 7%
Find a file
Sova a3f0d4ff59
Merge pull request #9 from satoryu/master
Use $GITHUB_OUTPUT instead of set-output
2023-01-14 17:10:38 +04:00
.dockerignore First release 2020-05-06 13:21:49 -05:00
.gitignore First release 2020-05-06 13:21:49 -05:00
action.yml Add multiline support 2021-12-22 18:50:37 -08:00
docker_build.sh Fixing where the docker is hosted 2020-05-06 13:35:49 -05:00
Dockerfile First release 2020-05-06 13:21:49 -05:00
entrypoint.sh Use $GITHUB_OUTPUT 2022-11-14 00:10:24 +09:00
LICENSE First release 2020-05-06 13:21:49 -05:00
LICENSE.GitHubActions First release 2020-05-06 13:21:49 -05:00
README.md Use table in README 2021-12-22 18:57:56 -08:00
tag.sh Fixing where the docker is hosted 2020-05-06 13:35:49 -05:00
test_runner.sh First release 2020-05-06 13:21:49 -05:00

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