Skip to content

Commit 5b5dd6f

Browse files
authored
fix: Simplifies workspace code in playwright.yml (#645)
Adds a simpler function for the change detection step.
1 parent cc100d4 commit 5b5dd6f

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

.github/workflows/playwright.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,14 @@ jobs:
5050
fetch-depth: 0
5151
lfs: true
5252

53-
- name: Fetch base branch for PR comparison
54-
if: github.event_name == 'pull_request'
55-
run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
56-
57-
- name: Set BASE_REF
58-
id: set_base_ref
59-
run: |
60-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
61-
echo "It's a pull_request!!!"
62-
echo "base_ref=origin/${{ github.base_ref }}" >> $GITHUB_OUTPUT
63-
else
64-
echo "It's the previous commit!!!"
65-
echo "base_ref=${{ github.event.before }}" >> $GITHUB_OUTPUT
66-
fi
67-
6853
- name: Get Affected Workspaces
6954
id: get_workspaces
70-
# For PRs, compare against the origin's version of the base branch.
71-
# For pushes, compare against the commit before the push.
72-
run: bash samples/find-changes.sh ${{ steps.set_base_ref.outputs.base_ref }}
55+
run: |
56+
BASE_REF=$([ "${{ github.event_name }}" == "pull_request" ] && echo "origin/${{ github.base_ref }}" || echo "${{ github.event.before }}")
57+
echo "Using BASE_REF: $BASE_REF" # Optional: for debugging
58+
bash samples/find-changes.sh "$BASE_REF"
59+
env:
60+
GIT_BASE_REF: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || github.event.before }}
7361

7462
- name: Setup Node.js
7563
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)