A GitHub Action to send detailed event information to Discord via webhooks. This action automatically detects the event type and job status to provide rich, contextual notifications with appropriate styling and links.
- π¨ Auto-styled notifications - Automatically applies colors and emojis based on event type and job status
- π΄ Red borders for failures - Failed jobs get red embeds with error indicators and workflow links
- π’ Green borders for success - Successful jobs get event-specific colors (green for pushes, purple for PRs, etc.)
- π Event-aware messaging - Customized titles and descriptions for each GitHub event type
- π¦ Detailed context - Repository info, commits, PR details, release info, and more
- π Secure - Webhook URL handling via GitHub secrets
- π Direct links - Quick access to workflow runs, commits, PRs, and issues
The action intelligently handles all GitHub events including:
- Push (π€ Blue) - Code pushes with commit details
- Pull Request (π Purple) - PR opened, closed, merged, etc.
- Release (π Cyan) - Release published, created, edited
- Issues (π Orange) - Issue opened, closed, labeled, etc.
- Deployments (π’ Cyan) - Deployment events and status
- Workflow Dispatch (
βΆοΈ Blue) - Manual workflow triggers - Schedule (β° Blue) - Scheduled workflow runs
- And many more...
The action automatically detects the event type and uses success as the default status:
name: Notify Discord
on: [push, pull_request, release]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send Discord notification
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}Use if: always() and pass ${{ job.status }} to get a single notification regardless of outcome:
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: npm test
- name: Notify Discord
if: always()
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
job-status: ${{ job.status }}This will automatically:
- Show red embed with β if tests fail
- Show green/blue embed with β if tests pass
- Include a link to view the workflow run
Override the auto-generated title and description:
- name: Custom Discord notification
if: always()
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
job-status: ${{ job.status }}
title: 'π Deployment Complete'
description: 'Application has been deployed to production'
color: '00ff00'- name: Simple Discord notification
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
include-details: false
title: 'Build completed'Automatically styled with purple border and PR details:
name: PR Notification
on: [pull_request]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Notify Discord
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}| Input | Description | Required | Default |
|---|---|---|---|
webhook-url |
Discord webhook URL (use secrets.DISCORD_WEBHOOK) |
Yes | - |
job-status |
Job status from context (use ${{ job.status }}). Auto-detects if not provided. |
No | success |
title |
Custom title for the Discord message (overrides auto-generated) | No | Auto-generated |
description |
Custom description for the Discord message (overrides auto-generated) | No | Auto-generated |
color |
Custom embed color (hex format without #, e.g., 00ff00). Overrides auto-detected color. |
No | Event/status-based |
include-details |
Include detailed event information (true/false) |
No | true |
- Open your Discord server settings
- Go to Integrations β Webhooks
- Click New Webhook or select an existing webhook
- Customize the webhook name and channel
- Click Copy Webhook URL
- In your GitHub repository, go to Settings β Secrets and variables β Actions
- Click New repository secret
- Name it
DISCORD_WEBHOOKand paste the webhook URL - Click Add secret
Security Note: Always use GitHub secrets to store your Discord webhook URL. Never hardcode the webhook URL in your workflow files or commit it to your repository, as this would expose your webhook to unauthorized access.
The action automatically includes relevant information based on the GitHub event type:
- Push events: Recent commit messages and commit links
- Pull Request events: PR number, title, and direct link to the PR
- Release events: Release tag, name, and link
- Issue events: Issue number, title, and link
- Deployment events: Deployment status and environment
The action intelligently chooses colors based on context:
Job Status Colors (takes priority for non-success):
- β Failure: Red (
dc3545) - Highly visible for errors β οΈ Cancelled: Gray (6c757d)- βοΈ Skipped: Yellow (
ffc107)
Event Type Colors (used for successful runs):
- π€ Push: Blue (
0366d6) - π Pull Request: Purple (
6f42c1) - π Release: Cyan (
17a2b8) - π Issues: Orange (
fd7e14) - β
Success: Green (
28a745)
You can override any color using the color input.
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build
run: npm run build
# Single notification that handles success/failure automatically
- name: Notify Discord
if: always()
uses: nitecon/discord-action@v2
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
job-status: ${{ job.status }}What this does:
- β Success: Shows green/blue embed with event-specific styling
- β Failure: Shows red embed with error indicators and workflow link
- π Pull Request: Automatically includes PR number, title, and link
- π€ Push: Shows commit messages and commit links
Monitor all activity on your main branch with automatic Discord notifications:
name: Main Branch Notifications
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, closed, reopened, synchronize]
release:
types: [published, created, edited]
issues:
types: [opened, closed, reopened]
workflow_dispatch:
jobs:
notify-discord:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Send Discord Notification
if: always()
uses: nitecon/discord-action@v2 # Use ./ for local testing in this repo
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}This workflow notifies on:
- π€ Pushes to main: Commit messages and links
- π Pull Requests: PR opened, closed, merged, or updated
- π Releases: New releases published or edited
- π Issues: Issues opened, closed, or reopened
βΆοΈ Manual Triggers: Workflow dispatch events
Each notification is automatically styled with the appropriate color and emoji based on the event type.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.