Skip to content

ci: notify Slack when release jobs fail, are cancelled, or never run - #118

Merged
ioannisj merged 3 commits into
mainfrom
chore/release-alert-on-cancelled
Nov 10, 2026
Merged

ioannisj merged 3 commits into
mainfrom
chore/release-alert-on-cancelled

Conversation

@ioannisj

@ioannisj ioannisj commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

💡 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 as cancelled, which stops the job before that step runs. That is how posthog-cli went five versions without publishing before anyone noticed (PostHog/posthog#132516).

Ports the release failure notification workflow from posthog-ios. It runs on workflow_run after every main-branch Release run and replies in the approval thread when a job failed, timed out, was cancelled, or never ran. release.yml gains a preserve-slack-thread job 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?

actionlint reports nothing new and node --check passes on the script. I haven't triggered a cancelled release to watch it fire.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm change to generate a change intent file

🤖 Agent context

DRI: @ioannisj

Autonomy: Human-driven (agent-assisted)

@ioannisj ioannisj self-assigned this Nov 10, 2026
@sampo-s-bot

sampo-s-bot Bot commented Nov 10, 2026

Copy link
Copy Markdown

⚠️ No changeset detected

No new .sampo/changesets/*.md files were detected in this PR. To add one:

  • run sampo add
  • follow the prompts to pick the affected packages and describe the change
  • commit the generated file to this pull request, and it will be detected automatically

If this PR isn't supposed to introduce any changes (e.g., documentation updates), you can ignore this message.

@ioannisj
ioannisj force-pushed the chore/release-alert-on-cancelled branch from eeb2aef to 4e283e7 Compare November 10, 2026 12:20
@ioannisj ioannisj changed the title chore: alert when the release job is cancelled ci: notify Slack when release jobs fail, are cancelled, or never run Nov 10, 2026
@ioannisj
ioannisj marked this pull request as ready for review November 10, 2026 14:10
@ioannisj
ioannisj requested a review from a team as a code owner November 10, 2026 14:10

@posthog posthog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +13 to +17
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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 turnipdabeets left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ioannisj
ioannisj merged commit 4b94579 into main Nov 10, 2026
22 checks passed
@ioannisj
ioannisj deleted the chore/release-alert-on-cancelled branch November 10, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants