Skip to content

Github Action Notification

Actions

About

Github Action Notification with Discord and Slack
v1.0.16
Latest
Star (26)

logo

A Github actions notification to Discord, Slack, Telegram, Google chat, Microsoft Teams, Support show QR code

Contributors License

Usage

uses: hunghg255/action-notifications@master
with:
  discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
  slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
  telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
  telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
  # telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
  google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
  ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
  title: "Deploy to Dev"
  description: "Test here: https://hung.thedev.id"

What's in a notification

Every notification includes, with a status color and emoji (✅ Success / ❌ Failure / ⚠️ Cancelled):

  • Repository (linked)
  • Branch or tag (linked)
  • Commit SHA (linked)
  • Event detail (commit message, PR title, or release notes)
  • Who triggered the run (with avatar on Discord)
  • Workflow name and run number, linked to the run

Runtime Compatibility

  • Action runtime: node24 (defined by GitHub Action metadata in action.yml).
  • Development and CI: Node.js 24.

For local development:

nvm use 24
npm ci
npm run type-check
npm test
npm run build

Local Discord Test Script

Use scripts/test-discord-local.js to validate Discord payload formatting and delivery without running a full GitHub Actions workflow.

Usage:

node scripts/test-discord-local.js <webhook_url> [title] [description]

Example:

node scripts/test-discord-local.js "https://discord.com/api/webhooks/..." "Node 24 Upgrade Test" "Testing Discord notification from local script"

What the script does:

  • Builds a mock GitHub context (push event, repository, actor, workflow run link).
  • Generates a Discord embed payload aligned with the action formatting logic.
  • Sends the payload to the provided webhook URL using axios.
  • Exits with code 0 on success and 1 on failure.

Security note:

  • Treat webhook URLs as secrets.
  • If a webhook URL is ever shared publicly, rotate it immediately in Discord.

Inputs

Properties Description
discord_webhook Discord Webhook
slack_webhook Slack Webhook
slack_username Slack Username
telegram_bot_token Telegram Bot Token Require telegram_chat_id
telegram_chat_id Telegram Chat ID Require telegram_bot_token
telegram_message_thread_id Telegram Thread Message For Topic
google_chat_webhook Google Chat Webhook
ms_teams_webhook Microsoft Teams Webhook
title Title
description Description
qrcode Text

Example

name: Notification

on:
  push:
    branches:
      - nofication

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Build and lint
        run: |
          echo "Build and lint"

      - name: Notification Failure
        if: failure()
        uses: hunghg255/action-notifications@master
        with:
          discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
          slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
          telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
          telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
          # Remove comment below for Telegram Topic Message
          # telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
          google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
          ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
          title: "Deploy to Dev"
          description: "Test here: https://hung.thedev.id"

  notifification:
    needs: deploy
    runs-on: ubuntu-latest

    steps:
      - name: Notification Success
        uses: hunghg255/action-notifications@master
        if: always()
        with:
          discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
          slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
          telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
          telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
          # Remove comment below for Telegram Topic Message
          # telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
          google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
          ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
          title: "Deploy to Dev"
          description: "Test here: https://hung.thedev.id"

Results

  • Discord

Discord

  • Slack

Slack

  • Telegram

Telegram

  • Google Chat

Google Chat

  • Microsoft Teams

Microsoft Teams

Github Action Notification is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Github Action Notification with Discord and Slack
v1.0.16
Latest

Github Action Notification is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.