fix: notify Slack when a release is rejected at the approval gate - #908
Merged
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-09-01 11:53:14 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Contributor
Prompt To Fix All With AI### Issue 1
.github/workflows/release.yml:548
**Multiline rejection comments are truncated**
When a reviewer submits a multiline rejection comment, `jq -r` emits physical newlines and `head -1` retains only the first line, causing the Slack reply to omit the rest of the rejection explanation.
```suggestion
COMMENT=$(echo "$RESPONSE" | jq -r 'first(.[] | select(.state == "rejected") | .comment // empty)')
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix: notify Slack when a release is reje..." | Re-trigger Greptile |
marandaneto
approved these changes
Sep 1, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
bot has a comment otherwise lgtm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Release run 33497521635 was rejected at the "Release" environment gate and nothing was posted to Slack.
release.ymlnotifies on approval needed, approved, failed and released, but there is no job for a rejection, so the thread just goes quiet and nobody watching it knows the release was turned down.This ports the
notify-rejectedjob that every other PostHog SDK already has (ruby, ios, android, js, go, php, dotnet), adapted to this repo. It hangs offversion-bump(the job carryingenvironment: "Release"here), reads the run's/approvalsto confirm it was an actual rejection rather than an ordinary failure, and replies in the existing Slack thread with the reviewer's comment when there is one.Two deliberate differences from the reference files:
slack-thread-replyto@main. This repo pins it to a SHA, so the new job reuses the SHA the other four Slack steps here already use.permissions: actions: readon the job, which the siblings do not have. The workflow setscontents: readat the top level, so without it theGITHUB_TOKENcarries noactionsscope, thegh api .../approvalscall 403s, and the job fails with the rejection still silent. Probably worth backporting to the other SDKs.💚 How did you test it?
There is no way to exercise this end to end without rejecting a real release, so I verified the logic against the run that prompted it, 33497521635:
Bump versions and commit to mainconcludedfailure, so the job'sifgate fires.GET /actions/runs/33497521635/approvalsreturns{"state": "rejected", "comment": "", "user": "ioannisj"}, so the check step setswas_rejected=true, and with an empty comment it takes the branch that posts the plain "Release was rejected." message.version-bump's own "Notify Slack - Failed" step never runs when the gate rejects, because none of that job's steps execute at all.I also parsed the workflow and confirmed every
needs.<job>reference resolves to a job that exists in the file.actionlintis not installed locally, so that check did not run.Two follow-up fixes after review, both in d6087af:
head -1truncated a multiline rejection comment to its first line. It was there to pick the first rejecting reviewer, not the first line, so it moved into jq asfirst(...). Worth noting the heredoc below it exists only to carry a multiline value, so withhead -1in front the block could never do anything.EOFline would close the block early and the rest would be parsed as step outputs.Verified both by running the step body against five payloads: multiline comment, empty comment (the path the real run took), approved-only, two rejecters, and a comment containing a literal
EOFline. The last one now lands as message content instead of setting a separate output key.All seven sibling SDKs carry the same
head -1and fixedEOFdelimiter, so both fixes want backporting.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileCI-only change with nothing to release, so no changeset.
🤖 Agent context
DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)