Skip to content

ci: notify Slack for PyPI approval#84

Merged
kj-podonos merged 2 commits into
mainfrom
kj-podonos/slack-pypi-approval
Jul 15, 2026
Merged

ci: notify Slack for PyPI approval#84
kj-podonos merged 2 commits into
mainfrom
kj-podonos/slack-pypi-approval

Conversation

@kj-podonos

@kj-podonos kj-podonos commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an @channel Slack approval card to the PyPI promote lane, and fixes a
notification gate bug found in review.

Feature (promote-prod.yml, docs/PUBLISH.md, RUNBOOK.md)

  • New notify-approval job posts a Slack Block Kit card once a validated
    release artifact is built: package version, release tag, repository, trigger
    type, and an Approve in GitHub button linking to the exact Actions run.
  • GitHub's pypi environment remains the sole approval gate. Slack is
    notification-only and best-effort — a delivery failure cannot change the
    publish decision. Silent on idempotent no-ops.

Fix (this branch, commit 872e987)

  • The notify jobs gated Slack on if: env.SLACK_WEBHOOK_URL != '' while
    defining SLACK_WEBHOOK_URL only at the step level. GitHub does not expose a
    step's own env: to that same step's if (only workflow/job env is visible),
    so the gate always read empty and every notify job took the skip branch —
    the card would never have posted. Hoisted SLACK_WEBHOOK_URL to job-level
    env on notify-approval, notify-success, and notify-failure.

Review

  • /code-review (xhigh): 1 confirmed correctness bug (the env gate above),
    now fixed. Verified against GitHub's contexts docs. Remaining items were
    low/non-blocking (parallel notify/pypi timing race — accepted; mutable
    slackapi/slack-github-action@v3 pin — deferred to a separate hardening PR).

Test plan

  • actionlint .github/workflows/*.yml clean
  • Full pytest suite passes (233 tests)
  • No secret values, Slack IDs, or private payloads in the diff
  • Post-merge: real prod-deploy dispatch posts the card and waits on the
    pypi environment (cannot run from a feature branch)

🤖 Generated with Claude Code

kj-podonos and others added 2 commits July 14, 2026 17:32
The `if: env.SLACK_WEBHOOK_URL != ''` guard read a step-level env var,
which GitHub does not expose to that same step's `if` (only workflow/job
env is visible). The gate always evaluated empty, so notify-approval,
notify-success, and notify-failure always took the skip branch and never
posted to Slack. Hoist SLACK_WEBHOOK_URL to job-level env on all three
jobs so the gate resolves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kj-podonos kj-podonos merged commit a3ee57d into main Jul 15, 2026
22 checks passed
@kj-podonos kj-podonos deleted the kj-podonos/slack-pypi-approval branch July 15, 2026 02:03
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