ci: prevent the Check workflow from running duplicated checks outputs

Prevent the Check workflow from running duplicated checks outputs.

The jq query should now be faster and arguably more readable.

Link: https://github.com/danth/stylix/pull/519
This commit is contained in:
NAHO 2024-12-31 16:47:17 +01:00
parent d3bdbf0c5b
commit 4ceede7504
No known key found for this signature in database
GPG key ID: 229CB671D09B95F5

View file

@ -23,38 +23,30 @@ jobs:
}}/${{
github.event.pull_request.head.sha || github.sha
}} |
jq --compact-output --raw-output '
to_entries |
map(
.key as $type |
select($type == "checks" or $type == "packages") |
.value |
to_entries |
map(
.key as $arch |
select($arch == "x86_64-linux" or $arch == "x86_64-darwin") |
.value |
to_entries |
map(
{
arch: $arch,
key: .key,
jq --raw-output '
def format_output($arch; $type):
{
arch: $arch,
key: .,
os: (
if $arch == "x86_64-linux" then
"ubuntu-24.04"
else
"macos-14"
end
),
os: (
if $arch == "x86_64-linux" then
"ubuntu-24.04"
else
"macos-14"
end
),
type: $type,
}
)
) |
flatten
) |
flatten |
type: $type
};
[
["x86_64-linux", "x86_64-darwin"][] as $arch |
(.checks[$arch] | keys) as $checks |
(.packages[$arch] | keys) as $packages |
(($checks - $packages)[] | format_output($arch; "checks")),
($packages[] | format_output($arch; "packages"))
] |
"derivations=\(.)"
' >> $GITHUB_OUTPUT