https://linear.app/docs/api-and-webhooks
PostHog + Linear already directly integrated
https://posthog.com/docs/session-replay/integrations
https://linear.app/integrations/posthog
The native integration mostly handles the manual side — a developer sees a session replay and clicks to create a ticket.
write Playwright tests and use PostHog API to generate sessions and Linear API to create issues automatically when Playwright tests fail
It does not natively support the fully automated flow from a Playwright failure. For that you still need the custom Linear API call I outlined previously, but you can enrich those auto-created tickets with direct PostHog replay links that open in the native integration UI, giving you the best of both worlds: automated ticket creation from CI and native replay linking when developers investigate manually.
Playwright test fails → During the test, you used PostHog's API to capture events/identify a session → On failure, you query PostHog's API to get the session replay URL → You call Linear's API to create a ticket with that URL embedded
Developer writes code
|
| git push / open PR
v
GitHub Actions (PR workflow)
- Vercel builds preview URL
- deployment_status fires "ready"
- Full Playwright suite runs against preview URL
- On failure: Linear ticket created with PostHog session
|
| PR approved and merged
v
Vercel deploys to Production
- deployment_status fires "ready" for Production
- Smoke test suite runs (@smoke tagged tests only)
- On failure: Linear ticket created, team alerted
|
| Developer working locally
v
Local (anytime)
- npx playwright test
- Runs against localhost via webServer config
- No Linear/PostHog integration needed locally
| Step | What to do |
|---|---|
| Vercel | Enable deployment webhooks or use deployment_status in GitHub Actions |
| PostHog | Add session recording to your app, inject session IDs from Playwright |
| Linear | Create an API key, get your team ID, optionally create an "e2e-failure" label |
| GitHub Secrets | POSTHOG_API_KEY, LINEAR_API_KEY, LINEAR_TEAM_ID, LINEAR_E2E_LABEL_ID |
| Deduplication | Search open Linear issues before creating to avoid noise |