From 79c626fede7d0a167cde0c1cd3bd52a57f5c5bbd Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 2 Jul 2026 15:18:30 +0200 Subject: [PATCH] ci: standardize SDK release failure telemetry --- .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b040fa..f7d8be6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -134,6 +134,29 @@ jobs: if-no-files-found: error retention-days: 5 + - name: Send failure event to PostHog + if: ${{ failure() }} + continue-on-error: true + uses: PostHog/posthog-github-action@9a6a19d360820ab4d95ecc4a5a7564062c895f84 # v1.3.0 + with: + posthog-token: "${{ secrets.POSTHOG_PROJECT_API_KEY }}" + event: "posthog-sdk-github-release-workflow-failure" + properties: >- + { + "commitSha": "${{ github.sha }}", + "jobStatus": "${{ job.status }}", + "ref": "${{ github.ref }}", + "repository": "${{ github.repository }}", + "sdk": "posthog-php", + "jobName": "prepare-release-candidate", + "packageName": "posthog-php", + "packageVersion": "${{ steps.candidate.outputs.new-version || 'unknown' }}", + "actionUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "alertText": ":rotating_light: Failed to prepare release candidate posthog-php@${{ steps.candidate.outputs.new-version }} :rotating_light:", + "alertContext": "The release candidate preparation step failed before approval or publish." + } + + verify-release-candidate: name: Verify release candidate needs: [check-changesets, prepare-release-candidate] @@ -213,6 +236,29 @@ jobs: - name: Validate composer files run: composer validate --no-check-lock --no-check-version --strict + - name: Send failure event to PostHog + if: ${{ failure() }} + continue-on-error: true + uses: PostHog/posthog-github-action@9a6a19d360820ab4d95ecc4a5a7564062c895f84 # v1.3.0 + with: + posthog-token: "${{ secrets.POSTHOG_PROJECT_API_KEY }}" + event: "posthog-sdk-github-release-workflow-failure" + properties: >- + { + "commitSha": "${{ github.sha }}", + "jobStatus": "${{ job.status }}", + "ref": "${{ github.ref }}", + "repository": "${{ github.repository }}", + "sdk": "posthog-php", + "jobName": "verify-release-candidate", + "packageName": "posthog-php", + "packageVersion": "${{ needs.prepare-release-candidate.outputs.new-version || 'unknown' }}", + "actionUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "alertText": ":rotating_light: Failed to verify release candidate posthog-php@${{ needs.prepare-release-candidate.outputs.new-version }} :rotating_light:", + "alertContext": "The release candidate verification step failed before approval or publish." + } + + notify-approval-needed: name: Notify Slack - Approval Needed needs: [check-changesets, prepare-release-candidate, verify-release-candidate] @@ -362,13 +408,20 @@ jobs: uses: PostHog/posthog-github-action@9a6a19d360820ab4d95ecc4a5a7564062c895f84 # v1.3.0 with: posthog-token: "${{ secrets.POSTHOG_PROJECT_API_KEY }}" - event: "posthog-php-github-release-workflow-failure" + event: "posthog-sdk-github-release-workflow-failure" properties: >- { "commitSha": "${{ github.sha }}", "jobStatus": "${{ needs.release.result }}", "ref": "${{ github.ref }}", - "version": "${{ needs.prepare-release-candidate.outputs.new-version }}" + "repository": "${{ github.repository }}", + "sdk": "posthog-php", + "jobName": "release", + "packageName": "posthog-php", + "packageVersion": "${{ needs.prepare-release-candidate.outputs.new-version || 'unknown' }}", + "actionUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "alertText": ":rotating_light: Failed to release posthog-php@${{ needs.prepare-release-candidate.outputs.new-version }} :rotating_light:", + "alertContext": "The release workflow failed before completion." } - name: Notify Slack - Failed