From 689fd55ff286b01017c7d77acee6c904ce12f85c Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 23 Feb 2025 18:13:26 +0100 Subject: [PATCH] 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 --- .github/workflows/check.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c6fe6d06..a82c9614 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 }}