Add live Slack notifications to release workflow#4046
Conversation
Post a single message to Slack when a release starts, then update it with threaded replies as each sub-job completes (PyPI publish, release notes, downstream testing, post-release PR, CLI skill sync). A final job updates the original message with overall success/failure status and adds an emoji reaction. Each thread reply includes relevant links (PyPI history, GitHub releases, downstream compare URLs, PR links). The Slack announcement file is uploaded as a thread attachment. All Slack steps use continue-on-error so failures never block the release. Notifications are skipped during dry runs. Requires: SLACK_BOT_TOKEN secret (chat:write, reactions:write, files:write scopes) and SLACK_CHANNEL_ID repository variable. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
- Include needs.prepare.result in the failure detection loop. If prepare fails after posting the Slack message (e.g. during git push), message_ts is set but nothing was published — without this check, the final message would incorrectly report success. - Add continue-on-error: true to match every other Slack step, so a Slack API failure doesn't cause the workflow to report as failed. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
In bash double quotes, \n is a literal backslash + n, not a newline. When passed through jq --arg, Slack receives the two-character string \n instead of a newline, breaking the block quote rendering. Use $'\n' concatenation to inject a real newline character. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
hanouticelina
left a comment
There was a problem hiding this comment.
conceptually looks good to me ✅
| - name: Install dependencies | ||
| run: pip install PyGithub | ||
|
|
||
| - name: Install OpenCode |
There was a problem hiding this comment.
it will be nice to check the version installed before and verify hash/checksum to avoid supply chain attack
| pull-requests: write | ||
|
|
||
| jobs: | ||
| # ============================================================ |
There was a problem hiding this comment.
permissions:
contents: write
| # ============================================================ | ||
| # 2. PUBLISH — PyPI (huggingface_hub) | ||
| # ============================================================ | ||
| publish-pypi: |
There was a problem hiding this comment.
probably enough
permissions:
contents: read
| # 3. PUBLISH — PyPI (hf CLI) | ||
| # ============================================================ | ||
| publish-hf-cli: | ||
| needs: prepare |
There was a problem hiding this comment.
probably enough
permissions:
contents: read
| # to the final version (removing prerelease flag). | ||
| # ============================================================ | ||
| release-notes: | ||
| needs: prepare |
There was a problem hiding this comment.
probably enough
permissions:
contents: write
| # 4b. SLACK MESSAGE — generate Slack announcement for prereleases | ||
| # ============================================================ | ||
| slack-message: | ||
| needs: [prepare, release-notes] |
There was a problem hiding this comment.
permissions:
contents: read
| # 5. DOWNSTREAM TESTING — test RC in transformers, datasets, etc. | ||
| # ============================================================ | ||
| test-downstream: | ||
| needs: [prepare, publish-pypi] |
There was a problem hiding this comment.
permissions:
contents: read
| # ============================================================ | ||
| # 6. POST-RELEASE — open PR to bump main to next dev version | ||
| # ============================================================ | ||
| post-release: |
There was a problem hiding this comment.
permissions:
contents: none ? due to github app (to verify)
| # ============================================================ | ||
| # 7. SYNC HF CLI SKILL — update skill docs in skills repo | ||
| # ============================================================ | ||
| sync-hf-cli-skill: |
There was a problem hiding this comment.
permissions:
contents: read
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write |
There was a problem hiding this comment.
permissions:
contents: write => better to remove from here and add separately on each job (read or write)
pull-requests: write +> IMO not needed
permissions: {}
Apply least-privilege permissions per job instead of broad top-level write access. Pin OpenCode install to a specific version. Move workflow inputs to env blocks to prevent script injection. Addresses security review from paulinebm in #4046. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
@paulinebm I have addressed all the security issues you've mentioned in a separate PR: #4072 |
* Harden release workflow permissions and inputs Apply least-privilege permissions per job instead of broad top-level write access. Pin OpenCode install to a specific version. Move workflow inputs to env blocks to prevent script injection. Addresses security review from paulinebm in #4046. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * Verify OpenCode binary checksum after install Use repository variables OPENCODE_VERSION and OPENCODE_SHA256 to pin the version and verify the binary integrity via sha256sum. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>

Note from myself: follow-up on the on-going work to streamline
huggingface_hubreleases. This PR adds a Slack Bot that will send messages to#hub-client-library-internalwith status of each step. This will make it more straightforward to retrieve URLs and generated messages.I have added
SLACK_BOT_TOKENas a secret andSLACK_CHANNEL_IDas a variable in this repo settings.Bot will be this one: https://api.slack.com/apps/A0AQJJYFFBM/general
Summary
.mdfile as a thread attachmentslack-completejob updates the original message ("started" → "completed"/"failed") and adds a ✅ or ❌ reactioncontinue-on-error: true— Slack issues never block the releasemessage_tsis empty (Slack init failed)Setup required
SLACK_BOT_TOKEN— Slack Bot User OAuth Token with scopes:chat:write,reactions:write,files:writeSLACK_CHANNEL_ID— target Slack channel ID🤖 Generated with Claude Code
Note
Medium Risk
Modifies the release GitHub Actions workflow to add Slack messaging and a new completion job; while Slack steps are non-blocking, changes touch the release pipeline and could affect execution flow/needs outputs if misconfigured.
Overview
Adds live Slack notifications to the
release.ymlworkflow: thepreparejob now posts a “release started” message and exports itsmessage_tsfor threading.Each major job (PyPI publishes, release notes, prerelease Slack announcement generation incl. file upload, downstream RC branches, post-release bump PR, and CLI skill sync) posts a ✅/❌ threaded status update, and a new
slack-completejob updates the original message with final success/failure plus a reaction. The post-release step also captures the created PR URL for linking in Slack, and the workflow docs now list required Slack secret/variable.Written by Cursor Bugbot for commit 91d22cd. This will update automatically on new commits. Configure here.