ci: make get-derivations job fail when input command fails (#888)

Make the get-derivations job fail when the command writing to the
$GITHUB_OUTPUT file fails.

Previously, the $GITHUB_OUTPUT file was successfully created when the
input command failed, resulting in an empty $GITHUB_OUTPUT file. [1]

[1]: https://stackoverflow.com/questions/59287865
This commit is contained in:
NAHO 2025-02-23 18:13:26 +01:00 committed by GitHub
parent f403ca101e
commit 689fd55ff2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,8 @@ jobs:
- id: get-derivations
run: |
set -o pipefail
nix flake show --json \
github:${{
github.repository
@ -51,7 +53,11 @@ jobs:
($packages[] | format_output($arch; "packages"))
] |
"derivations=\(.)"
' >>$GITHUB_OUTPUT
' \
>>"$GITHUB_OUTPUT" || {
rm "$GITHUB_OUTPUT"
false
}
outputs:
derivations: ${{ steps.get-derivations.outputs.derivations }}