sync-screenshot.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Sync Screenshot
  2. on: workflow_dispatch
  3. concurrency:
  4. group: "manual-sync-screenshot"
  5. cancel-in-progress: false
  6. jobs:
  7. e2e:
  8. # can not update screenshot run on main.
  9. if: github.ref_name != 'main'
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v3
  13. - uses: actions/setup-node@v3
  14. with:
  15. node-version: 18
  16. - name: Set Git user.name and user.email from trigger actor
  17. run: |
  18. git config --global user.name "${{ github.actor }}"
  19. git config --global user.email "${{ github.actor }}@users.noreply.github.com"
  20. - name: Rush Install
  21. run: node common/scripts/install-run-rush.js install
  22. - name: Rush build
  23. run: node common/scripts/install-run-rush.js build
  24. - name: Install Playwright Browsers
  25. run: npx playwright install --with-deps
  26. - name: Run E2E tests
  27. run: node common/scripts/install-run-rush.js e2e:update-screenshot --verbose
  28. - name: Commit and push changes
  29. env:
  30. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  31. run: |
  32. git add .
  33. if git diff-index --quiet HEAD; then
  34. echo "No changes to commit"
  35. else
  36. git commit -m "chore: sync screenshot"
  37. git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }}
  38. fi