Skip to content

Instantly share code, notes, and snippets.

@PureKrome
Created February 14, 2025 08:55
Show Gist options
  • Save PureKrome/71b565d3e1ab0be8397350b50e83a27b to your computer and use it in GitHub Desktop.
Save PureKrome/71b565d3e1ab0be8397350b50e83a27b to your computer and use it in GitHub Desktop.
GitHub Action to notify a Slack Channel when a PR is *merged*
name: Notify Slack via Email on PR Merge
on:
pull_request:
branches: [ main ]
types:
- closed
jobs:
notify:
if: github.event.pull_request.merged == true # Only run if PR is merged
runs-on: ubuntu-latest
steps:
- name: Send Slack Notification
uses: slackapi/slack-github-action@v1
with:
channel-id: "your-slack-channel-goes-here"
slack-message: "📝 PR #${{ github.event.pull_request.number }}: *${{ github.event.pull_request.title }}* : Created by ${{ github.event.pull_request.user.login }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment