Skip to content

ci: add Slack notification workflow for teammate PRs to main#1460

Draft
esabou-snyk wants to merge 1 commit into
mainfrom
task/notify-slack-pr-review
Draft

ci: add Slack notification workflow for teammate PRs to main#1460
esabou-snyk wants to merge 1 commit into
mainfrom
task/notify-slack-pr-review

Conversation

@esabou-snyk

Copy link
Copy Markdown
Contributor

Summary

Adds .github/workflows/notify-slack-pr-review.yml, which posts a Slack message when a teammate opens (or marks ready for review) a non-draft PR targeting main.

  • Trigger: pull_request with types: [opened, ready_for_review], branches: [main].
  • Skips drafts and only fires for authors in the TEAMMATE_HANDLES repo variable (JSON array of GitHub usernames).
  • Posts via slackapi/slack-github-action@v1.27.0 using an incoming webhook (SLACK_WEBHOOK_URL secret).
  • Message includes PR title (as link), author handle, and a :memo: marker.

Setup required before merge

This PR is a draft because the workflow references config that must be added in the repo Settings UI first — otherwise every PR run would fail on fromJSON(vars.TEAMMATE_HANDLES):

  1. Repo secret SLACK_WEBHOOK_URL — incoming webhook URL pointing at #team-docs.
  2. Repo variable TEAMMATE_HANDLES — JSON array of teammate GitHub handles, e.g. ["alice","bob","charlie"].

Once both are set and this PR is marked ready, the guard clauses will start matching real events.

Test plan

  • Configure SLACK_WEBHOOK_URL secret and TEAMMATE_HANDLES variable in repo Settings.
  • Open a test PR from an allowlisted teammate against main → confirm one Slack message lands in #team-docs with correct title, link, and author.
  • Open a draft PR from an allowlisted teammate → no Slack message. Mark it ready for review → exactly one message fires.
  • Open a PR from a handle not in TEAMMATE_HANDLES → workflow runs but notify job is skipped (visible in the Actions tab).
  • Open a PR against a non-main base → workflow does not trigger.

🤖 Generated with Claude Code

Fires on pull_request opened/ready_for_review targeting main, skips
drafts, and posts a Slack message to the channel behind the
SLACK_WEBHOOK_URL secret. Author is filtered against the
TEAMMATE_HANDLES repo variable (JSON array of GitHub usernames), so the
list is editable in the GitHub UI without a PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@snyk-io

snyk-io Bot commented Jul 15, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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