-
Notifications
You must be signed in to change notification settings - Fork 4k
[feat] Add snapshot autofix workflow for E2E test snapshots #13697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| run: | | ||
| echo "sha_short=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-6)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Wait for Playwright tests to complete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested if the update_e2e_snapshots.py script would work on CI if we passed in the token from CI via the --token argument? It should be able to handle the waiting and other aspects already and might just need to logic to create an autofix PR like here:
streamlit/.github/workflows/autofix.yml
Lines 59 to 92 in 429841c
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| git add -A | |
| git status --porcelain | |
| echo "changes=$(if git diff --staged --quiet; then echo false; else echo true; fi)" >> $GITHUB_OUTPUT | |
| - name: Commit changes to new branch | |
| if: steps.git-check.outputs.changes == 'true' && github.event.pull_request.head.repo.full_name == github.repository | |
| run: | | |
| git config user.email "core+streamlitbot-github@streamlit.io" | |
| git config user.name "Streamlit Bot" | |
| fix_branch="autofix/${{ github.event.pull_request.number }}-${{ github.run_id }}" | |
| git checkout -b "$fix_branch" | |
| git add -A | |
| git commit -m "Apply automatic fixes" | |
| git push --set-upstream origin "$fix_branch" | |
| - name: Create PR with autofix changes | |
| if: steps.git-check.outputs.changes == 'true' && github.event.pull_request.head.repo.full_name == github.repository | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_BODY: | | |
| ## Describe your changes | |
| Automated fixes for #${{ github.event.pull_request.number }} created via the autofix CI workflow. The autofix workflow is triggered by adding the `autofix` label to a PR. This runs formatting, linting, pre-commit, and other automatically fixable tasks (see `make autofix`). | |
| |
|
| This PR targets a feature branch and can be merged without review approval. | |
| run: | | |
| gh pr create \ | |
| --head "autofix/${{ github.event.pull_request.number }}-${{ github.run_id }}" \ | |
| --base "${{ github.head_ref }}" \ | |
| --title "[autofix] Automated fixes for #${{ github.event.pull_request.number }}" \ | |
| --body "$PR_BODY" |

Describe your changes
Added a new GitHub Actions workflow for automatically updating E2E test snapshots when Playwright tests fail. This workflow is triggered when the 'snapshots' label is added to a PR and:
update_e2e_snapshots.pyscript to download and merge snapshot artifactsThe workflow includes special handling for fork PRs, displaying a notice that manual updates are required since GitHub Actions tokens are read-only for forked PRs.
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.