:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(devex): link master CI alerts to engineering analytics workflow detail (#68742)
Julian Bez7eb7d2b4f5ef
diff --git a/.github/scripts/ci-alerts-devex.js b/.github/scripts/ci-alerts-devex.jsindex 5da6d9fdfc35..0a2cf3214aa9 100644--- a/.github/scripts/ci-alerts-devex.js+++ b/.github/scripts/ci-alerts-devex.js@@ -31,6 +31,11 @@const SLACK_API = 'https://slack.com/api'const INCIDENT_EVENT_TYPE = 'master_ci_incident'+// Per-workflow links point at the engineering analytics workflow-detail page (not GitHub), scoped+// to master via that product's `?q=` branch filter. Hosted in the team-devex project (347861) for+// now, before it moves to its final home; it's the project with the PostHog/posthog GitHub source+// synced. `owner`/`repo` come from the run context; the workflow's GitHub display name is the path key.+const ENG_ANALYTICS_BASE = 'https://us.posthog.com/project/347861/engineering-analytics'// One page of channel history. #alerts-devex is low-traffic, so the open anchor// reliably stays within the newest 100 messages; a busier channel would need paging.const HISTORY_LIMIT = 100@@ -292,9 +297,10 @@ function formatDuration(mins) {// Slack mrkdwn requires escaping these three in user-supplied text.const slackEscape = (text) => String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')-// A workflow's run history on master — where you can see all of its runs at a glance.-function runsUrlFor(owner, repo, workflowFile) {- return `https://github.com/${owner}/${repo}/actions/workflows/${workflowFile}?query=branch%3Amaster`+// A workflow's run history on master, in engineering analytics — where you can see all of its+// runs at a glance. The path key is the workflow's GitHub display name (e.g. "Backend CI").+function runsUrlFor(owner, repo, workflowName) {+ return `${ENG_ANALYTICS_BASE}/${owner}/${repo}/actions/workflows/${encodeURIComponent(workflowName)}?q=master`}// Read-boundary normalizer for persisted incident workflows: tolerate an older@@ -442,7 +448,7 @@ module.exports = async ({ context, github, core }, { now: _now, slack: _slack, fconst redForMins = Math.round((now.getTime() - new Date(f.since).getTime()) / 60000)return {...f,- runsUrl: runsUrlFor(owner, repo, f.workflow_file),+ runsUrl: runsUrlFor(owner, repo, f.name),redForMins, // detection: byDuration + open/resolve thresholdsdisplayRedForMins: Math.round((now.getTime() - new Date(f.displaySince).getTime()) / 60000),byCount: f.consecutive_failures >= workflowThreshold,diff --git a/.github/scripts/ci-alerts-devex.test.js b/.github/scripts/ci-alerts-devex.test.jsindex 79c2b1700418..f31e28d7f014 100644--- a/.github/scripts/ci-alerts-devex.test.js+++ b/.github/scripts/ci-alerts-devex.test.js@@ -179,7 +179,8 @@ describe('ci-alerts-devex', () => {const body = JSON.stringify(anchor.attachments)assert.match(body, /Backend CI/)assert.match(body, /5 failed runs in a row/)- assert.match(body, /actions\/workflows\/ci-backend\.yml\?query=branch/) // per-workflow runs link+ // per-workflow link → engineering analytics workflow detail, scoped to master+ assert.match(body, /engineering-analytics\/PostHog\/posthog\/actions\/workflows\/Backend%20CI\?q=master/)assert.equal(anchor.metadata.event_type, 'master_ci_incident')assert.equal(anchor.metadata.event_payload.status, 'active')assert.deepEqual(@@ -223,7 +224,7 @@ describe('ci-alerts-devex', () => {const thread = slack.postMessage.calls[0][0].textassert.match(thread, /now also failing/)assert.match(thread, /Frontend CI/)- assert.match(thread, /actions\/workflows\/ci-frontend\.yml\?query=branch/)+ assert.match(thread, /engineering-analytics\/PostHog\/posthog\/actions\/workflows\/Frontend%20CI\?q=master/)})it('strikes through the anchor and threads recovery on resolve', async () => {