Skip to content

Commit

Permalink
feat: Added Telegram notification step to the action
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Nov 30, 2024
1 parent a844e35 commit 1e7d6ce
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
name: "Storm Software - Notification"
description: "A composite action configuration used across many Storm Software repos to setup: checkout, Node.js, a package manager, and npm registry configuration."
author: "sullivanpj"

branding:
icon: "speaker"
color: "gray-dark"

inputs:
title:
description: Text to display in the notification
Expand All @@ -22,21 +27,27 @@ inputs:
description: Status to display in the notification
required: true
default: "In Progress"
slackToken:
description: The github username of the Storm bot
slack-token:
description: The Slack token used by the bot
required: true
telegram-token:
description: The Telegram token used by the bot
required: true
discordWebhook:
telegram-chat:
description: The Telegram chat used by the bot
required: true
discord-webhook:
description: The github username of the Storm bot
required: true
stormBot:
storm-bot:
description: The github username of the Storm bot
required: false
default: "Stormie-Bot"

runs:
using: "composite"
steps:
- name: Send Slack notification - Deployment started
- name: Send Slack notification
uses: slackapi/[email protected]
with:
channel-id: "notifications"
Expand All @@ -58,14 +69,24 @@ runs:
]
}
env:
SLACK_BOT_TOKEN: ${{ inputs.slackToken }}
SLACK_BOT_TOKEN: ${{ inputs.slack-token }}

- name: Send Discord notification - Deployment started
- name: Send Discord notification
uses: Ilshidur/action-discord@master
with:
args: "${{ inputs.title }}"
args: ${{ inputs.title }}
env:
DISCORD_WEBHOOK: ${{ inputs.discordWebhook }}
DISCORD_USERNAME: ${{ inputs.stormBot }}
DISCORD_WEBHOOK: ${{ inputs.discord-webhook }}
DISCORD_USERNAME: ${{ inputs.storm-bot }}
DISCORD_AVATAR: "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-stormie.png"
DISCORD_EMBEDS: '[{"title": "${{ inputs.subtitle }}", "description": "${{ inputs.description }}", "thumbnail": { "url": "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png" }, "image": { "url": "https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-fill.png" }, "author": { "name": "${{ github.actor }}", "url": "https://github.com/${{ github.actor }}", "icon_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4" }, "fields": [ { "name": "Repository", "value": "${{ github.repository }}" }, { "name": "Repository URL", "value": "${{ github.repositoryUrl }}" }, { "name": "Pipeline Status", "value": "${{ inputs.status }}" }], "color": ${{ inputs.color }}, "timestamp": "${{ github.event.repository.updated_at }}", "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}", "footer": { "text": "Click here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}", "icon_url": "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png" } }]'

- name: Send Telegram notification
uses: storm-software/action-telegram-notify@main
with:
status: ${{ inputs.status }}
token: ${{ inputs.telegram-token }}
chat: ${{ inputs.telegram-chat }}
env:
TELEGRAM_TOKEN: ${{ inputs.telegram-token }}
TELEGRAM_CHAT: ${{ inputs.telegram-chat }}

0 comments on commit 1e7d6ce

Please sign in to comment.