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@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2
  22. - name: Check for files changed
  23. uses: getsentry/paths-filter@66f7f1844185eb7fb6738ea4ea59d74bb99199e5 # v2
  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@e832d70549c14886ddc2ab809b436ba72e30e19b # 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 }}