Skip to content

Commit a9f1b9a

Browse files
authored
fix: Updates how BASE_REF works (#636)
From our digital overlord: In this updated workflow: We've added a new step, "Set BASE_REF for PRs," that runs only for pull requests. It sets an output variable base_ref to origin/{0}, which should be the correct base reference in that context. In the "Get Affected Workspaces" step, we now use this output variable (if it exists) as the argument to find-changes.sh. If the workflow is triggered by a push (or anything other than a pull request), the set_base_ref step will be skipped, and the condition will evaluate to github.event.before (the same behavior as in your release.yml workflow). This approach ensures that find-changes.sh always receives a consistent and accurate base reference, making the process more reliable and easier to understand.
1 parent a3be429 commit a9f1b9a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎.github/workflows/playwright.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ jobs:
5050
fetch-depth: 0
5151
lfs: true
5252

53+
- name: Set BASE_REF for PRs
54+
id: set_base_ref
55+
if: github.event_name == 'pull_request'
56+
run: echo "base_ref=origin/${{ github.base_ref }}" >> $GITHUB_OUTPUT
57+
5358
- name: Get Affected Workspaces
5459
id: get_workspaces
5560
# For PRs, compare against the origin's version of the base branch.
5661
# For pushes, compare against the commit before the push.
57-
run: bash samples/find-changes.sh ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || github.event.before }}
62+
run: bash samples/find-changes.sh ${{ steps.set_base_ref.outputs.base_ref || github.event.before }}
5863

5964
- name: Setup Node.js
6065
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)