Created
February 14, 2025 08:55
-
-
Save PureKrome/71b565d3e1ab0be8397350b50e83a27b to your computer and use it in GitHub Desktop.
GitHub Action to notify a Slack Channel when a PR is *merged*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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