@@ -217,68 +217,16 @@ jobs:
217217 name : playwright-artifacts
218218 path : playwright-artifacts
219219
220+ - name : Setup git config
221+ run : |
222+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
223+ git config --global user.name "github-actions[bot]"
224+
220225 - name : Analyze test changes
221226 id : analyze_tests
222- shell : bash
223227 run : |
224- set -e
225-
226- echo "Creating temporary files..."
227- current_tests_file=$(mktemp)
228- base_tests_file=$(mktemp)
229-
230- function cleanup {
231- echo "Cleaning up temporary files..."
232- rm -f "$current_tests_file" "$base_tests_file"
233- }
234- trap cleanup EXIT
235-
236- function extract_tests() {
237- local file=$1
238- echo "Processing file: $file" >&2
239- # Look for test declarations and extract just the test name between quotes
240- perl -ne 'if (/test\(['\''"](.+?)['\''"]/) { print "$1|'$file'\n" }' "$file"
241- }
242-
243- echo "Extracting current branch tests..."
244- while IFS= read -r file; do
245- extract_tests "$file"
246- done < <(find tests/suites -type f -name "*.test.ts") | sort > "$current_tests_file"
247-
248- echo "Fetching main branch..."
249- git fetch origin main:main
250-
251- echo "Saving current branch name..."
252- current_branch=$(git rev-parse --abbrev-ref HEAD)
253-
254- echo "Checking out main branch..."
255- git checkout main
256-
257- echo "Extracting main branch tests..."
258- while IFS= read -r file; do
259- if [ -f "$file" ]; then
260- extract_tests "$file"
261- fi
262- done < <(find tests/suites -type f -name "*.test.ts") | sort > "$base_tests_file"
263-
264- echo "Returning to original branch..."
265- git checkout "$current_branch"
266-
267- echo "Comparing test files..."
268- new_tests=0
269- test_details=""
270-
271- while IFS='|' read -r test_name file; do
272- if ! grep -Fq "$test_name|" "$base_tests_file"; then
273- ((new_tests++))
274- test_details+="- ✨ Added test: \`$test_name\` in \`$file\`\\n"
275- fi
276- done < "$current_tests_file"
277-
278- echo "new_tests=$new_tests" >> $GITHUB_OUTPUT
279- echo "test_details<<EOF" >> $GITHUB_OUTPUT
280- echo -e "$test_details" >> $GITHUB_OUTPUT
281- echo "EOF" >> $GITHUB_OUTPUT
228+ chmod +x .github/scripts/test-analyzer.sh
229+ ./.github/scripts/test-analyzer.sh >> $GITHUB_OUTPUT
282230
283231 - name : Update PR description
284232 uses : actions/github-script@v6
0 commit comments