8000 [feat] Add snapshot autofix workflow for E2E test snapshots by sfc-gh-nbellante · Pull Request #13697 · streamlit/streamlit · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@sfc-gh-nbellante
Copy link
Contributor
@sfc-gh-nbellante sfc-gh-nbellante commented Jan 26, 2026

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:

  1. Runs the update_e2e_snapshots.py script to download and merge snapshot artifacts
  2. Creates a new branch with the updated snapshots
  3. Opens a PR targeting the original feature branch with the snapshot updates
  4. Removes the 'snapshots' label from the source PR once complete

The 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

  • No additional tests needed as this is a CI workflow improvement
  • The workflow will be tested in real-world usage when PRs with failing snapshots are labeled with 'snapshots'
  • Success criteria: workflow should automatically create PRs with updated snapshots when triggered

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor
snyk-io bot commented Jan 26, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor
github-actions bot commented Jan 26, 2026

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13697/streamlit-1.53.1-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13697.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Contributor Author
sfc-gh-nbellante commented Jan 26, 2026

run: |
echo "sha_short=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-6)" >> $GITHUB_OUTPUT

- name: Wait for Playwright tests to complete
Copy link
Collaborator

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:

- 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"

@sfc-gh-nbellante sfc-gh-nbellante changed the title Add snapshot autofix workflow for E2E test snapshots [feat] Add snapshot autofix workflow for E2E test snapshots Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0