playwright: get latest Netlify branch deploy, rm awaiting new build#16377
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the Playwright workflow to fetch the latest Netlify branch deploy instead of waiting for a new build to complete. The changes prevent triggering unnecessary new builds during manual workflow dispatches.
- Replaces the wait-for-netlify-action with a custom TypeScript script that retrieves the latest published deploy for the current branch
- Removes the awaiting mechanism that was causing new builds to be triggered during manual workflow runs
- Adds branch filtering to only run on dev, staging, and master branches
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/scripts/get-netlify-branch-deploy.ts | New script that fetches the latest published Netlify deploy for the current branch via API |
| .github/workflows/playwright.yml | Updated workflow step to use the new script instead of waiting for new deployments |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (!latest) { | ||
| console.error("No published deploy found for branch:", branch) | ||
| process.exit(1) | ||
| } |
There was a problem hiding this comment.
The fallback logic may result in an undefined URL. If both deploy_ssl_url and deploy_url are undefined, the output will be url=undefined. Consider adding validation to ensure at least one URL exists before proceeding.
| } | |
| } | |
| // Ensure at least one URL exists | |
| if (!latest.deploy_ssl_url && !latest.deploy_url) { | |
| console.error("No deploy URL found for the latest published deploy.") | |
| process.exit(1) | |
| } |
| if: | | ||
| github.ref_name == 'dev' || github.ref_name == 'staging' || github.ref_name == 'master' | ||
| run: | | ||
| npm install node-fetch@2 |
There was a problem hiding this comment.
Installing dependencies in workflow steps is not a best practice as it adds overhead and potential failure points. Consider adding node-fetch to the project's package.json dependencies or using Node.js built-in fetch (available in Node 18+).
| npm install node-fetch@2 |
pettinarip
left a comment
There was a problem hiding this comment.
Good catch! forgot about this part, thanks
| // Use GitHub Actions recommended output syntax (GITHUB_OUTPUT) | ||
| const output = `url=${latest.deploy_ssl_url || latest.deploy_url}` | ||
| if (process.env.GITHUB_OUTPUT) { | ||
| fs.appendFileSync(process.env.GITHUB_OUTPUT, output + "\n") |

Description
Related Issue
Even with manual dispatch of playwright e2e test workflow (#16372), workflow is triggering a new build:
https://github.com/ethereum/ethereum-org-website/actions/runs/18041407774/job/51341063177
cc: @pettinarip