Repository navigation
ci: notify Slack when release jobs fail, are cancelled, or never run - #118
Conversation
|
eeb2aef to
4e283e7
Compare
There was a problem hiding this comment.
PostHog Review · Standard · reviewed a7faf22: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
| const attempts = readdirSync(directory) | ||
| .map(name => /^release-slack-thread-(\d+)$/.exec(name)?.[1]) | ||
| .filter(value => value && Number(value) <= attempt) | ||
| .sort((a, b) => Number(b) - Number(a)); | ||
| if (attempts.length === 0) return undefined; |
There was a problem hiding this comment.
P2 · Handle the single-artifact download layout
When a run has one matching artifact, the pinned download-artifact@v8.0.2 extracts thread-ts.txt directly into THREAD_DIRECTORY. readThreadTimestamp only accepts named subdirectories, so it returns undefined and first-attempt failure alerts start new channel messages despite a saved approval thread. Support the single-artifact layout when reading the timestamp.
turnipdabeets
left a comment
There was a problem hiding this comment.
LGTM. Every job and step name the notifier looks up matches this repo's release workflow, and the privileged workflow only runs code from the default branch.
💡 Motivation and Context
A release job that gets cancelled never reaches Slack. The failure notification is a step inside the release job gated on
failure(), and GitHub reports a job timeout, a runner it can't schedule, or a manual stop ascancelled, which stops the job before that step runs. That is howposthog-cliwent five versions without publishing before anyone noticed (PostHog/posthog#132516).Ports the release failure notification workflow from posthog-ios. It runs on
workflow_runafter every main-branchReleaserun and replies in the approval thread when a job failed, timed out, was cancelled, or never ran.release.ymlgains apreserve-slack-threadjob that saves the approval thread timestamp as a run artifact so the alert can find the thread. The in-job Slack failure replies are removed, since the notifier covers them; the PostHog failure events stay. CI-only, so no changeset.No feature flag controls this change.
💚 How did you test it?
actionlintreports nothing new andnode --checkpasses on the script. I haven't triggered a cancelled release to watch it fire.📝 Checklist
If releasing new changes
pnpm changeto generate a change intent file🤖 Agent context
DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)