sync-screenshot.yml 1.4 KB

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