install-jq/action.yaml
Daniel Carbone 4fcb5062d7
feat: add jq 1.8.1 and 1.8.2, default to 1.8.2 (#27)
- Add 1.8.1 and 1.8.2 to the test-linux and test-container matrices.
- Bump default version in action.yaml from 1.7.1 to 1.8.2.
- Update README tested-version list and default snippet.
- Update example workflow dispatch defaults to 1.8.2.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 13:57:18 -05:00

86 lines
3.1 KiB
YAML

name: Install jq
description: |
Installs a version of jq into the job tool cache using simple shell scripts
branding:
icon: copy
color: orange
inputs:
version:
required: false
description: "Version of jq to install."
default: "1.8.2"
force:
required: false
description: "If 'true', does not check for existing jq installation before continuing."
default: 'false'
outputs:
found:
description: "If 'true', jq was already found on this runner"
value: "${{ steps.jq-check-unix.outputs.found == 'true' || steps.jq-check-windows.outputs.found == 'true' }}"
installed:
description: "If 'true', jq was installed by this action"
value: "${{ inputs.force == 'true' || steps.jq-check-unix.outputs.found == 'false' || steps.jq-check-windows.outputs.found == 'false' }}"
runs:
using: composite
steps:
- name: 'Check for jq - Unix-ish'
id: jq-check-unix
if: (runner.os == 'Linux' || runner.os == 'macOS')
shell: sh +e {0}
# language=sh
run: |
_jq_bin="$(which jq)"
if [ -f "${_jq_bin}" ]; then
echo "found=true" >> $GITHUB_OUTPUT
else
echo "found=false" >> $GITHUB_OUTPUT
fi
- name: 'Install jq - Unix-ish sub-1.7'
if: (runner.os == 'Linux' || runner.os == 'macOS') && (startsWith(inputs.version, '1.5') || startsWith(inputs.version, '1.6')) && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
shell: sh
env:
JQ_VERSION: '${{ inputs.version }}'
# language=sh
run: ${GITHUB_ACTION_PATH}/scripts/unixish.sh
- name: 'Install jq - Unix-ish 1.7+'
if: (runner.os == 'Linux' || runner.os == 'macOS') && (startsWith(inputs.version, '1.7') || startsWith(inputs.version, '1.8')) && (steps.jq-check-unix.outputs.found == 'false' || inputs.force == 'true')
shell: sh
env:
JQ_VERSION: '${{ inputs.version }}'
# language=sh
run: ${GITHUB_ACTION_PATH}/scripts/unixish-17.sh
- name: 'Check for jq - Windows-ish'
id: jq-check-windows
if: runner.os == 'Windows'
shell: powershell
# language=powershell
run: |
if (Get-Command "jq.exe" -ErrorAction SilentlyContinue)
{
Add-Content $Env:GITHUB_OUTPUT "found=true"
}
else
{
Add-Content $Env:GITHUB_OUTPUT "found=false"
}
- name: 'Install jq - Windows-ish sub-1.7'
if: runner.os == 'Windows' && (startsWith(inputs.version, '1.5') || startsWith(inputs.version, '1.6')) && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
shell: powershell
env:
JQ_VERSION: '${{ inputs.version }}'
run: ${{ github.action_path }}\scripts\windowsish.ps1
- name: 'Install jq - Windows-ish 1.7+'
if: runner.os == 'Windows' && (startsWith(inputs.version, '1.7') || startsWith(inputs.version, '1.8')) && (steps.jq-check-windows.outputs.found == 'false' || inputs.force == 'true')
shell: powershell
env:
JQ_VERSION: '${{ inputs.version }}'
run: ${{ github.action_path }}\scripts\windowsish-17.ps1