Skip to content

Commit

Permalink
ci: store jq output before writing to file
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Howard <[email protected]>
  • Loading branch information
jhoward-lm committed Nov 18, 2024
1 parent fc81569 commit 5e590e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ function export_db_json {
objects+=("$( printf '{"%s": %s}' "$table" "$rows")")
done

echo "${objects[@]}" | jq --slurp --sort-keys \
'reduce .[] as $obj ({}; . += $obj)' > bomctl-export.json
output=$(echo "${objects[@]}" | jq --slurp --sort-keys 'reduce .[] as $obj ({}; . += $obj)')
echo "$output" > bomctl-export.json
}

function export_db_sql {
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ runs:
run: .github/scripts/run-command.sh

- name: Install SQLite
if: (fromJSON(inputs.export-json) || fromJSON(inputs.export-sql)) && runner.os != 'Linux'
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: ${{ runner.os == 'Windows' && 'choco' || 'brew' }} install sqlite
if: (fromJSON(inputs.export-json) || fromJSON(inputs.export-sql)) && runner.os == 'Windows'
shell: pwsh
run: choco install sqlite --limit-output --no-progress

- name: Export database to JSON
if: fromJSON(inputs.export-json)
Expand Down

0 comments on commit 5e590e4

Please sign in to comment.