cloudposse / cloudposse/github-action-matrix-extended
JQ fails when affected stacks is empty
- Dominant language
- No language data
- Stars
- 10
- Forks
- 2
- Avg merge
- 1h 57m
- Merged PRs (30d)
- 2
Description
## Describe the Bug
When updating our atmos repo, if we do not touch any component, catalog or stack files JQ fails to correctly parse the output.
```
jq: error: syntax error, unexpected ';' (Unix shell quoting issues?) at , line 1:
def name: ;
jq: 1 compile error
Error: The process '/usr/bin/jq' failed with exit code 3
```
When I run atmos locally the output is `[]` as expected
```
➜ affected=$(jq -c '.' affected-stacks.json)
➜ echo $affected
[]
➜ echo $affected | jq
[]
```
we are running `cloudposse/github-action-atmos-affected-stacks@v3` which calls this action
## Expected Behavior
`cloudposse/github-action-atmos-affected-stacks@v3` runs successfully and returns an empty set so
`if: ${{ needs.context.outputs.has-affected-stacks == 'true' }}` returns false correct and doesn't run more jobs based on the matrix.
## Steps to Reproduce
```
name: "terraform plan matrix"
permissions:
id-token: write
contents: read
pull-requests: write
on:
pull_request:
types: [opened, synchronize, reopened]
env:
ATMOS_LOGS_LEVEL: Off
jobs:
context:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: affected
uses: cloudposse/github-action-atmos-affected-stacks@v3
with:
nested-matrices-count: 1
outputs:
affected: ${{ steps.affected.outputs.affected }}
has-affected-stacks: ${{ steps.affected.outputs.has-affected-stacks }}
matrix: ${{ steps.affected.outputs.matrix }}
```
## Screenshots


## Environment (please complete the following information):
Github actions runner `ubuntu-latest`
## Additional Context
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.