From 6e990f390398201f40f2ce91eaad6921e5fd9a35 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Thu, 2 Jul 2026 15:18:29 +0200 Subject: [PATCH] ci: standardize SDK release failure telemetry --- .github/workflows/publish-pub-dev.yml | 20 +++++++++++++------ .github/workflows/publish.yml | 28 ++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-pub-dev.yml b/.github/workflows/publish-pub-dev.yml index e3a4b715..2a996a77 100644 --- a/.github/workflows/publish-pub-dev.yml +++ b/.github/workflows/publish-pub-dev.yml @@ -98,16 +98,24 @@ jobs: # Notify in case of failure - name: Send failure event to PostHog if: ${{ failure() }} - uses: PostHog/posthog-github-action@58dea254b598fb5d469c0699c98af8288a7f7650 # v1.2.0 + continue-on-error: true + uses: PostHog/posthog-github-action@9a6a19d360820ab4d95ecc4a5a7564062c895f84 # v1.3.0 with: posthog-token: '${{ secrets.POSTHOG_PROJECT_API_KEY }}' - event: 'posthog-flutter-release-workflow-failure' + event: 'posthog-sdk-github-release-workflow-failure' properties: >- { "commitSha": "${{ github.sha }}", "jobStatus": "${{ job.status }}", "ref": "${{ github.ref }}", - "packageVersion": "${{ steps.get-version.outputs.version }}" + "repository": "${{ github.repository }}", + "sdk": "posthog-flutter", + "jobName": "publish", + "packageName": "posthog_flutter", + "packageVersion": "${{ steps.get-version.outputs.version || 'unknown' }}", + "actionUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "alertText": ":rotating_light: Failed to publish posthog_flutter@${{ steps.get-version.outputs.version }} to pub.dev :rotating_light:", + "alertContext": "The pub.dev publish workflow failed." } - name: Restore Slack thread_ts from cache @@ -130,7 +138,7 @@ jobs: - name: Notify Slack - Failed continue-on-error: true if: ${{ failure() && steps.slack-thread-for-failure.outputs.thread_ts != '' }} - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }} @@ -172,7 +180,7 @@ jobs: - name: Notify Slack - Released if: needs.publish.result == 'success' continue-on-error: true - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }} @@ -183,7 +191,7 @@ jobs: - name: Notify Slack - Failed if: needs.publish.result == 'failure' continue-on-error: true - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74e52f41..98ae39e5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -67,7 +67,7 @@ jobs: steps: - name: Notify Slack - Approved continue-on-error: true - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }} @@ -160,10 +160,32 @@ jobs: git tag -a "$NEW_VERSION" -m "$NEW_VERSION" git push origin "$NEW_VERSION" + - 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-flutter", + "jobName": "version-bump", + "packageName": "posthog_flutter", + "packageVersion": "${{ steps.apply-changesets.outputs.new-version || 'unknown' }}", + "actionUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "alertText": ":rotating_light: Failed to prepare release posthog_flutter@${{ steps.apply-changesets.outputs.new-version }} :rotating_light:", + "alertContext": "The version bump/changelog step failed before packages were published." + } + - name: Notify Slack - Failed continue-on-error: true if: ${{ failure() && needs.notify-approval-needed.outputs.slack_ts != '' }} - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }} @@ -203,7 +225,7 @@ jobs: - name: Notify Slack - Rejected if: steps.check-rejection.outputs.was_rejected == 'true' continue-on-error: true - uses: PostHog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c + uses: PostHog/.github/.github/actions/slack-thread-reply@cb0979b67dcd585828b61ac45927eef4da8f6287 # main with: slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }} slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }}