Skip to content

feat: add reusable PR Slack notification workflow#3

Draft
tomassrnka wants to merge 5 commits intomainfrom
pr-slack-notify
Draft

feat: add reusable PR Slack notification workflow#3
tomassrnka wants to merge 5 commits intomainfrom
pr-slack-notify

Conversation

@tomassrnka
Copy link
Copy Markdown
Member

Summary

  • Reusable workflow that any e2b-dev repo can call to post new PRs to a Slack channel
  • Tags a configurable Slack user group (e.g. @pr-infra, @pr-belt)
  • Each repo just needs a ~10 line caller workflow + two repo variables

Usage in a repo

# .github/workflows/pr-slack-notify.yml
name: Post PR to Slack
on:
  pull_request_target:
    types: [opened, ready_for_review]
jobs:
  notify:
    uses: e2b-dev/.github/.github/workflows/pr-slack-notify.yml@main
    secrets:
      SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
    with:
      channel_id: ${{ vars.SLACK_CHANNEL_ID }}
      review_group: ${{ vars.SLACK_REVIEW_GROUP }}

Repo variables needed:

  • SLACK_CHANNEL_ID — the #code-review-requests channel ID
  • SLACK_REVIEW_GROUP — Slack user group ID (e.g. for @pr-infra)

Test plan

  • Merge this PR
  • Set up a caller workflow in infra repo (separate PR)
  • Trigger via workflow_dispatch or open a test PR
  • Verify message in #code-review-requests

🤖 Generated with Claude Code

Reusable workflow that posts new PRs to a Slack channel, tagging a
configurable user group. Any e2b-dev repo can call it with a 10-line
workflow file and its own SLACK_CHANNEL_ID / SLACK_REVIEW_GROUP vars.

Includes:
- Slack mrkdwn injection prevention (escaped PR titles)
- Pinned dependencies (package-lock.json + npm ci)
- Draft PR skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

PR Summary

Medium Risk
Introduces a new GitHub reusable workflow that posts to Slack using a bot token; misconfiguration or token/channel issues could cause missed/incorrect notifications but does not affect production code paths.

Overview
Adds a reusable GitHub Actions workflow, pr-slack-notify.yml, that can be workflow_call’d by other repos to post new PR notifications to Slack, tagging a configurable user group.

Includes a small Node-based action (.github/actions/pr-slack-notify) that installs @slack/web-api and posts the message, skipping draft PRs, supporting manual triggers via env-provided PR fields, and escaping Slack mrkdwn in PR titles to avoid mention/injection.

Reviewed by Cursor Bugbot for commit 30f4a6e. Bugbot is set up for automated code reviews on this repo. Configure here.

tomassrnka added a commit to e2b-dev/infra that referenced this pull request Apr 13, 2026
Move the PR Slack notification script and logic to the org-level
e2b-dev/.github repo (PR e2b-dev/.github#3). This repo now has a
thin 18-line caller workflow. Any e2b-dev repo can reuse the same
workflow with its own SLACK_REVIEW_GROUP variable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tomassrnka and others added 2 commits April 13, 2026 12:47
The script had a manual trigger path (PR_URL/PR_NUMBER env vars) that
was never reachable from the reusable workflow. Simplified to only
read from the event payload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shows which repo the PR is from (e.g. e2b-dev/infra#123) so the
channel is useful once multiple repos use this workflow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add PR_NUMBER/PR_TITLE/PR_URL/PR_AUTHOR optional inputs to the
  reusable workflow so callers can add workflow_dispatch for testing
- Escape pipe (|) character in PR titles — it breaks Slack's link
  syntax (<url|label>) when used literally inside angle brackets
- Extract escaping into escapeSlackLabel() function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Reviewed by Cursor Bugbot for commit 817b6ca. Configure here.

Slack only decodes &amp; &lt; &gt; — &#124; renders literally.
Pipe in the label portion of <url|label> doesn't break the link
since Slack splits on the first | only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant