Skip to content

Add live Slack notifications to release workflow#4046

Merged
Wauplin merged 5 commits intomainfrom
release-slack-notifications
Apr 9, 2026
Merged

Add live Slack notifications to release workflow#4046
Wauplin merged 5 commits intomainfrom
release-slack-notifications

Conversation

@Wauplin
Copy link
Copy Markdown
Contributor

@Wauplin Wauplin commented Apr 3, 2026

Note from myself: follow-up on the on-going work to streamline huggingface_hub releases. This PR adds a Slack Bot that will send messages to #hub-client-library-internal with status of each step. This will make it more straightforward to retrieve URLs and generated messages.

I have added SLACK_BOT_TOKEN as a secret and SLACK_CHANNEL_ID as a variable in this repo settings.

Bot will be this one: https://api.slack.com/apps/A0AQJJYFFBM/general


Summary

  • Posts a Slack message when a release starts (with type emoji: 🏗️ pre-release, 🚢 release, 🐛 patch)
  • Each sub-job posts a threaded reply on completion with ✅/❌ status and relevant links:
    • PyPI → links to huggingface-hub / hf history
    • Release notes → links to GitHub releases page
    • Slack announcement → uploads the generated .md file as a thread attachment
    • Downstream testing → links to compare URL per repo (transformers, datasets, diffusers, sentence-transformers)
    • Post-release → links to the version bump PR
    • CLI skill sync → status
  • A final slack-complete job updates the original message ("started" → "completed"/"failed") and adds a ✅ or ❌ reaction
  • All Slack steps use continue-on-error: true — Slack issues never block the release
  • Skipped during dry runs and when message_ts is empty (Slack init failed)

Setup required

  1. Secret SLACK_BOT_TOKEN — Slack Bot User OAuth Token with scopes: chat:write, reactions:write, files:write
  2. Repository variable SLACK_CHANNEL_ID — target Slack channel ID
  3. Invite the bot to the channel

🤖 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.yml workflow: the prepare job now posts a “release started” message and exports its message_ts for 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-complete job 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.

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]>
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented Apr 3, 2026

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.

@Wauplin Wauplin marked this pull request as ready for review April 3, 2026 12:49
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
- 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]>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread .github/workflows/release.yml
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]>
Copy link
Copy Markdown
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

conceptually looks good to me ✅

Comment thread .github/workflows/release.yml
- name: Install dependencies
run: pip install PyGithub

- name: Install OpenCode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it will be nice to check the version installed before and verify hash/checksum to avoid supply chain attack

pull-requests: write

jobs:
# ============================================================
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:
contents: write

# ============================================================
# 2. PUBLISH — PyPI (huggingface_hub)
# ============================================================
publish-pypi:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably enough
permissions:
contents: read

# 3. PUBLISH — PyPI (hf CLI)
# ============================================================
publish-hf-cli:
needs: prepare
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably enough
permissions:
contents: read

# to the final version (removing prerelease flag).
# ============================================================
release-notes:
needs: prepare
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably enough
permissions:
contents: write

# 4b. SLACK MESSAGE — generate Slack announcement for prereleases
# ============================================================
slack-message:
needs: [prepare, release-notes]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:                                                                   
  contents: read 

# 5. DOWNSTREAM TESTING — test RC in transformers, datasets, etc.
# ============================================================
test-downstream:
needs: [prepare, publish-pypi]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:                                                                   
  contents: read

# ============================================================
# 6. POST-RELEASE — open PR to bump main to next dev version
# ============================================================
post-release:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:                                                                   
  contents: none ? due to github app (to verify)

# ============================================================
# 7. SYNC HF CLI SKILL — update skill docs in skills repo
# ============================================================
sync-hf-cli-skill:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:                                                                   
  contents: read 


permissions:
contents: write
pull-requests: write
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

permissions:
contents: write => better to remove from here and add separately on each job (read or write)
pull-requests: write +> IMO not needed

permissions: {}

Wauplin added a commit that referenced this pull request Apr 9, 2026
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]>
@Wauplin
Copy link
Copy Markdown
Contributor Author

Wauplin commented Apr 9, 2026

@paulinebm I have addressed all the security issues you've mentioned in a separate PR: #4072

Wauplin added a commit that referenced this pull request Apr 9, 2026
* 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]>
@Wauplin Wauplin merged commit 3a8ee52 into main Apr 9, 2026
19 of 21 checks passed
@Wauplin Wauplin deleted the release-slack-notifications branch April 9, 2026 08:22
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.

3 participants