Skip to content

Commit

Permalink
sort tags
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Oct 20, 2023
1 parent b1d5845 commit 0563546
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ jobs:
expected_file=./test-data/analysis-output.yaml
actual_file=./output/output.yaml
function filter_and_sort() {
yq e 'del(.[].skipped) | del(.[].unmatched)' $1 > /tmp/filtered
yq e '.[]?.violations |= (. | to_entries | sort_by(.key) | from_entries)' /tmp/filtered > /tmp/sorted
yq e '.[]?.violations[]?.incidents |= sort_by(.uri)' /tmp/sorted > $1
yq e 'del(.[].skipped) | del(.[].unmatched)' $1 \
| yq e '.[]?.violations |= (. | to_entries | sort_by(.key) | from_entries)' \
| yq e '.[]?.violations[]?.incidents |= sort_by(.uri)' \
| yq e '.[] | (.tags // []) |= sort'
}
filter_and_sort $expected_file
filter_and_sort $actual_file
filter_and_sort $expected_file > $expected_file
filter_and_sort $actual_file > $actual_file
diff $expected_file $actual_file
- name: Fail if dependencies output does not match expected
Expand Down

0 comments on commit 0563546

Please sign in to comment.