Files
Compose-Files/Backups/Miker/Learning CI-CD/Send a Discord or Telegram Notification.md
2026-07-20 09:23:17 -04:00

2.0 KiB

tags
tags
GIT
CI/CD
CI-CD

Here is how to add instant notifications to your setup and solve the common homelab issue of mismatched storage paths between your testing runner and your live production server.


🔔 Part 1: Send a Discord or Telegram Notification

You can easily append a notification step to the very end of your workflow. By utilizing Gitea's conditional blocks (if: always()), you can ensure you get notified whether the deployment succeeds or crashes.

Option A: Sending to Discord

  1. Open your Discord server, go to your target channel settings, click Integrations, and create a Webhook. Copy the URL.

  2. Store that URL in your Gitea Repository Secrets as DISCORD_WEBHOOK.

       - name: Send Discord Status Notification
         if: always() # Ensures this runs even if the deployment failed
         uses: https://github.com
         with:
           verify: false
           url: ${{ secrets.DISCORD_WEBHOOK }}
    
       # Evaluates the final outcome of the job to change the message dynamically
       title: "Homelab Deployment: ${{ job.status == 'success' && '✅ SUCCESS' || '❌ FAILED' }}"
       description: "The commit '${{ gitea.event.head_commit.message }}' by ${{ gitea.actor }} has finished processing."
       color: ${{ job.status == 'success' && '0x00FF00' || '0xFF0000' }}
    

Option B: Sending to Telegram

  1. Message @BotFather on Telegram to create a new bot and copy your Bot Token.
  2. Message @userinfobot to find your personal Chat ID.
  3. Save these in Gitea Secrets as TELEGRAM_TOKEN and TELEGRAM_TO.
    • name: Send Telegram Status Notification if: always() uses: https://github.com with: token: ${{ secrets.TELEGRAM_TOKEN }} to: ${{ secrets.TELEGRAM_TO }} message: | Homelab Deploy Status: ${{ job.status }} Actor: ${{ gitea.actor }} Commit: ${{ gitea.event.head_commit.message }}