Skip to content

chore: bump the github-actions group across 1 directory with 2 updates #564

chore: bump the github-actions group across 1 directory with 2 updates

chore: bump the github-actions group across 1 directory with 2 updates #564

name: Sentry Snapshots
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'src/**'
- 'public/**'
- 'index.html'
- 'package.json'
- 'playwright.config.ts'
- 'e2e/**'
- '.github/workflows/sentry-snapshots.yml'
- '.github/actions/setup/**'
concurrency:
group: sentry-snapshots-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
snapshots:
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
environment: preview
permissions:
contents: read
env:
PLAYWRIGHT_SNAPSHOT_OUTPUT_DIR: .artifacts/sentry-snapshots
SENTRY_SNAPSHOTS_ENABLED: ${{ vars.SENTRY_SNAPSHOTS_ENABLED }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_SENTRY_ENVIRONMENT: preview
VITE_SENTRY_PR: ${{ github.event.pull_request.number }}
VITE_SENTRY_TOOLBAR: 'true'
VITE_SENTRY_ORGANIZATION: ${{ secrets.SENTRY_ORG }}
VITE_SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Setup app
uses: ./.github/actions/setup
- name: Validate snapshot environment
run: |
missing=()
for name in VITE_SENTRY_DSN VITE_SENTRY_ORGANIZATION VITE_SENTRY_PROJECT; do
if [ -z "${!name:-}" ]; then
missing+=("$name")
fi
done
if [ "${SENTRY_SNAPSHOTS_ENABLED:-}" = "true" ] && [ -z "${SENTRY_AUTH_TOKEN:-}" ]; then
missing+=("SENTRY_AUTH_TOKEN")
fi
if [ "${#missing[@]}" -gt 0 ]; then
echo "Missing required snapshot environment: ${missing[*]}" >&2
exit 1
fi
- name: Install Playwright browser
run: pnpm exec playwright install --with-deps chromium
- name: Capture deterministic observability snapshots
run: pnpm run test:e2e:observability
- name: Upload snapshot artifact for debugging
if: always() && hashFiles('.artifacts/sentry-snapshots/**/*.png') != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sentry-snapshots-pr-${{ github.event.pull_request.number }}
path: .artifacts/sentry-snapshots
- name: Upload snapshots to Sentry
id: sentry_upload
if: env.SENTRY_SNAPSHOTS_ENABLED == 'true' && hashFiles('.artifacts/sentry-snapshots/**/*.png') != ''
continue-on-error: true
run: >
pnpm dlx @sentry/cli@3.5.1 snapshots upload
"$PLAYWRIGHT_SNAPSHOT_OUTPUT_DIR"
--app-id charm-web-preview
--log-level debug
- name: Note Sentry snapshot upload failure
if: always() && steps.sentry_upload.outcome == 'failure'
run: |
{
echo "### Sentry Snapshot Upload"
echo
echo "- Deterministic screenshot coverage ran successfully for this pull request."
echo "- Snapshot upload to Sentry failed, but the workflow is continuing."
echo "- Review the \`Upload snapshots to Sentry\` step logs for the CLI/server error details."
} >> "$GITHUB_STEP_SUMMARY"
- name: Note Sentry snapshot upload status
if: env.SENTRY_SNAPSHOTS_ENABLED != 'true'
run: |
{
echo "### Sentry Snapshot Upload"
echo
echo "- Deterministic screenshot coverage ran successfully for this pull request."
echo "- Upload to Sentry is currently disabled for this repository."
echo "- Enable the repository variable \`SENTRY_SNAPSHOTS_ENABLED=true\` after the Sentry project has snapshot upload support."
} >> "$GITHUB_STEP_SUMMARY"