Skip to content

Commit d63505d

Browse files
committed
Don't panic when all packages are already up to date
1 parent bfb3be3 commit d63505d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/build-copr-packages.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,15 @@ jobs:
138138
SCRIPT_OUTPUT=$(./scripts/packages/check-copr-versions.sh $CHANGED_PKGS 2>&1)
139139
echo "$SCRIPT_OUTPUT"
140140
141-
# Extract packages that need building from the script output
142-
NEEDS_BUILD=$(echo "$SCRIPT_OUTPUT" | grep "^NEEDS_BUILD_JSON=" | sed 's/^NEEDS_BUILD_JSON=//' | jq -r '.[]' | tr '\n' ' ')
141+
# Extract packages that need building from the script output.
142+
# `grep` exits 1 when nothing matches (all packages up to date);
143+
# tolerate that so set -o pipefail doesn't kill the step.
144+
JSON_LINE=$(echo "$SCRIPT_OUTPUT" | grep "^NEEDS_BUILD_JSON=" || true)
145+
if [[ -n "$JSON_LINE" ]]; then
146+
NEEDS_BUILD=$(echo "$JSON_LINE" | sed 's/^NEEDS_BUILD_JSON=//' | jq -r '.[]' | tr '\n' ' ')
147+
else
148+
NEEDS_BUILD=""
149+
fi
143150
fi
144151
145152
echo ""

0 commit comments

Comments
 (0)