Skip to content

Commit c8f06a2

Browse files
committed
Add alerting
1 parent bf3a175 commit c8f06a2

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

.github/workflows/e2e.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,30 @@ jobs:
6363
PERSONAL_ACCESS_KEY: ${{ secrets.PERSONAL_ACCESS_KEY }}
6464
PROJECT_ID: ${{ vars.PROJECT_ID }}
6565

66+
- name: Send failure event to PostHog
67+
if: ${{ failure() }}
68+
uses: PostHog/[email protected]
69+
# A CDP destination is set-up to alert when we get this event
70+
with:
71+
posthog-token: '${{ secrets.POSTHOG_API_TOKEN }}'
72+
event: 'posthog-examples-repo-test-failure'
73+
properties: >-
74+
{
75+
"commitSha": "${{ github.sha }}",
76+
"jobStatus": "${{ job.status }}",
77+
"commitMessage": "${{ github.event.head_commit.message }}",
78+
"commitAuthor": "${{ github.event.head_commit.author.name }}",
79+
"ref": "${{ github.ref }}",
80+
"workflow": "${{ github.workflow }}",
81+
"runId": "${{ github.run_id }}",
82+
"runNumber": "${{ github.run_number }}",
83+
"matrixExample": "${{ matrix.example }}"
84+
}
85+
6686
- uses: actions/upload-artifact@v4
6787
if: always()
6888
with:
6989
name: playwright-report-${{ matrix.example }}
7090
path: basics/${{ matrix.example }}/playwright-report/
7191
retention-days: 30
7292

73-
# TODO: report to PostHog which will warn in channel for failure.

.github/workflows/integration.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,29 @@ jobs:
6565
NEXT_PUBLIC_POSTHOG_KEY: ${{ vars.NEXT_PUBLIC_POSTHOG_KEY }}
6666
NEXT_PUBLIC_POSTHOG_HOST: ${{ vars.NEXT_PUBLIC_POSTHOG_HOST }}
6767

68+
- name: Send failure event to PostHog
69+
if: ${{ failure() }}
70+
uses: PostHog/[email protected]
71+
# A CDP destination is set-up to alert when we get this event
72+
with:
73+
posthog-token: '${{ secrets.POSTHOG_API_TOKEN }}'
74+
event: 'posthog-examples-repo-test-failure'
75+
properties: >-
76+
{
77+
"commitSha": "${{ github.sha }}",
78+
"jobStatus": "${{ job.status }}",
79+
"commitMessage": "${{ github.event.head_commit.message }}",
80+
"commitAuthor": "${{ github.event.head_commit.author.name }}",
81+
"ref": "${{ github.ref }}",
82+
"workflow": "${{ github.workflow }}",
83+
"runId": "${{ github.run_id }}",
84+
"runNumber": "${{ github.run_number }}",
85+
"example": "${{ matrix.example }}"
86+
}
87+
6888
- uses: actions/upload-artifact@v4
6989
if: always()
7090
with:
7191
name: playwright-report-${{ matrix.example }}
7292
path: basics/${{ matrix.example }}/playwright-report/
7393
retention-days: 30
74-
75-
# TODO: report to PostHog which will warn in channel for failure.

0 commit comments

Comments
 (0)