11name : Run changed or added tests
22
33on :
4- workflow_call :
5- inputs :
6- base_ref :
7- description : ' Base branch to compare against'
8- required : false
9- default : ' main'
10- type : string
11- workflow_dispatch :
12- inputs :
13- base_ref :
14- description : ' Base branch to compare against'
15- required : false
16- default : ' main'
17- type : string
4+ workflow_call :
5+ inputs :
6+ base_ref :
7+ description : ' Base branch to compare against'
8+ required : false
9+ default : ' main'
10+ type : string
11+ workflow_dispatch :
12+ inputs :
13+ base_ref :
14+ description : ' Base branch to compare against'
15+ required : false
16+ default : ' main'
17+ type : string
1818
1919jobs :
2020 run-changed-or-added-tests :
2929 uses : actions/checkout@v4
3030 with :
3131 fetch-depth : 0
32-
32+
3333 - name : Set up Node.js and Playwright
3434 uses : ./.github/actions/setup-playwright
3535
3838 run : |
3939 BASE_REF="${{ inputs.base_ref || 'main' }}"
4040 git fetch origin "$BASE_REF"
41- NEW_TESTS=$(git diff --name-only --diff-filter=ACMR "$BASE_REF"...HEAD -- tests/ || echo '')
42-
41+ NEW_TESTS=$(git diff --name-only --diff-filter=ACMR origin/ "$BASE_REF"...HEAD -- tests/ || echo '')
42+
4343 if [ -z "$NEW_TESTS" ]; then
4444 echo "No new or changed tests found"
4545 echo "has_new_tests=false" >> $GITHUB_OUTPUT
@@ -59,16 +59,16 @@ jobs:
5959 if : ${{ steps.find-new-tests.outputs.has_new_tests == 'true' }}
6060 id : list-tests
6161 run : |
62- TEST_FILES=$(echo "${{ steps.find-new-tests.outputs.new_test_files }}" | tr '\n' ' ' )
63-
62+ TEST_FILES=$(echo "${{ steps.find-new-tests.outputs.new_test_files }}" | xargs )
63+
6464 if [ -z "$TEST_FILES" ]; then
6565 echo "No test files to process"
6666 echo "has_new_tests=false" >> $GITHUB_OUTPUT
6767 exit 0
6868 fi
69-
69+
7070 TEST_LIST=$(yarn playwright test --project=${{ matrix.project }} "$TEST_FILES" --list || echo '')
71-
71+
7272 if [ -z "$TEST_LIST" ]; then
7373 echo "No tests found for project ${{ matrix.project }}"
7474 echo "has_new_tests=false" >> $GITHUB_OUTPUT
9090 with :
9191 name : new-tests-results-${{ matrix.project }}-${{ github.run_id }}
9292 path : playwright-report/
93- retention-days : 7
93+ retention-days : 7
0 commit comments