Skip to content

Commit 85873c1

Browse files
Anton StandrikAnton Standrik
authored andcommitted
fix: tests
1 parent 848882f commit 85873c1

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/scripts/test-analyzer.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
#!/bin/bash
22
set -e
33

4+
# Redirect all non-output logs to stderr
5+
exec 3>&1
6+
exec 1>&2
7+
48
echo "Creating temporary files..."
59
current_tests_file=$(mktemp)
610
base_tests_file=$(mktemp)
711

812
function cleanup {
913
echo "Cleaning up temporary files..."
1014
rm -f "$current_tests_file" "$base_tests_file"
15+
# Restore any stashed changes
16+
if git rev-parse --verify --quiet stash@{0} >/dev/null; then
17+
echo "Restoring stashed changes..."
18+
git stash pop
19+
fi
1120
}
1221
trap cleanup EXIT
1322

1423
function extract_tests() {
1524
local file=$1
16-
echo "Processing file: $file" >&2
25+
echo "Processing file: $file"
1726
# Look for test declarations and extract just the test name between quotes
1827
perl -ne 'if (/test\(['\''"](.+?)['\''"]/) { print "$1|'$file'\n" }' "$file"
1928
}
@@ -29,6 +38,9 @@ git fetch origin main:main
2938
echo "Saving current branch name..."
3039
current_branch=$(git rev-parse --abbrev-ref HEAD)
3140

41+
echo "Stashing any changes..."
42+
git stash -u
43+
3244
echo "Checking out main branch..."
3345
git checkout main
3446

@@ -53,8 +65,11 @@ while IFS='|' read -r test_name file; do
5365
fi
5466
done < "$current_tests_file"
5567

68+
# Switch back to stdout for GitHub Actions output
69+
exec 1>&3
70+
5671
# Output in GitHub Actions format
57-
echo "new_tests=$new_tests"
72+
echo "new_tests=${new_tests}"
5873
echo "test_details<<EOF"
59-
echo -e "$test_details"
74+
echo -e "${test_details}"
6075
echo "EOF"

0 commit comments

Comments
 (0)