Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dispatch Discord

GitHub Marketplace License

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.

Features

  • 🎨 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

Supported Events

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...

Usage

Simplest Usage - Auto-detect Everything

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 }}

Recommended - Single Notification with Job Status

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

Custom Title and Description

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'

Minimal Notification (Without Details)

- name: Simple Discord notification
  uses: nitecon/discord-action@v2
  with:
    webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
    include-details: false
    title: 'Build completed'

Pull Request Notifications

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 }}

Inputs

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

Setting Up Discord Webhook

  1. Open your Discord server settings
  2. Go to Integrations β†’ Webhooks
  3. Click New Webhook or select an existing webhook
  4. Customize the webhook name and channel
  5. Click Copy Webhook URL
  6. In your GitHub repository, go to Settings β†’ Secrets and variables β†’ Actions
  7. Click New repository secret
  8. Name it DISCORD_WEBHOOK and paste the webhook URL
  9. 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.

Event-Specific Information

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

Color Logic

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.

Examples

Complete CI/CD Workflow

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

Main Branch Activity Notifications

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Proper discord action to notify based on events.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages