visual-diff.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: visual diff
  2. on:
  3. # This allows PRs opened from forks to execute the Visual Snapshots
  4. # since secrets are not passed to workflows when triggered via forks
  5. # Using workflow_run is less preferred since it executes even when jobs
  6. # do not pass
  7. workflow_run:
  8. workflows:
  9. - acceptance
  10. types:
  11. - completed
  12. jobs:
  13. files-changed:
  14. name: detect what files changed
  15. runs-on: ubuntu-20.04
  16. timeout-minutes: 3
  17. # Map a step output to a job output
  18. outputs:
  19. acceptance: ${{ steps.changes.outputs.acceptance }}
  20. steps:
  21. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  22. - name: Check for files changed
  23. uses: getsentry/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
  24. id: changes
  25. with:
  26. token: ${{ github.token }}
  27. filters: .github/file-filters.yml
  28. visual-diff:
  29. needs: files-changed
  30. # Only execute this check when a PR is opened from a fork rather than the upstream repo
  31. if: github.event.workflow_run.head_repository.full_name != 'getsentry/sentry' && needs.files-changed.outputs.acceptance == 'true'
  32. runs-on: ubuntu-20.04
  33. timeout-minutes: 20
  34. steps:
  35. - name: Diff snapshots
  36. id: visual-snapshots-diff
  37. uses: getsentry/action-visual-snapshot@5811b6c34e1ec3b9fc30613d4b55ef740fec6086 # main
  38. with:
  39. api-token: ${{ secrets.VISUAL_SNAPSHOT_SECRET }}
  40. gcs-bucket: 'sentry-visual-snapshots'
  41. gcp-service-account-key: ${{ secrets.SNAPSHOT_GOOGLE_SERVICE_ACCOUNT_KEY }}