diff mbox series

[RFC,v5,04/10] CI: stop setting FAILED_TEST_ARTIFACTS N times

Message ID RFC-patch-v5-04.10-1482f840f64-20220421T183001Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series CI: js/ci-github-workflow-markup rebased on "use $GITHUB_ENV" | expand

Commit Message

Ævar Arnfjörð Bjarmason April 21, 2022, 6:36 p.m. UTC
The FAILED_TEST_ARTIFACTS variable introduced in f72f328bc57 (ci: let
GitHub Actions upload failed tests' directories, 2020-04-11) is only
used once in the main.yml, there is no need to set it N times if we
have N failing tests.

See also 92bf1b60673 (ci: avoid `set-env` construct in
print-test-failures.sh, 2020-11-17) which moved it to using
$GITHUB_ENV, we'll now check if it's set like ci/lib.sh, this makes it
easier to test this script locally.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 ci/print-test-failures.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
index 23324021f13..27df5081f8b 100755
--- a/ci/print-test-failures.sh
+++ b/ci/print-test-failures.sh
@@ -49,7 +49,6 @@  do
 		case "$CI_TYPE" in
 		github-actions)
 			mkdir -p t/failed-test-artifacts
-			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
 			cp "t/test-results/${TEST_OUT}" t/failed-test-artifacts/
 			(
 				cd t &&
@@ -62,6 +61,11 @@  done
 
 if test -n "$failed"
 then
+	if test -n "$GITHUB_ENV"
+	then
+		echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
+	fi
+
 	if test -n "$exit_code"
 	then
 		exit 1