Git Product home page Git Product logo

telegram-action's Introduction

๐Ÿš€ Telegram for GitHub Actions

GitHub Action for sending a Telegram notification message.

Usage

Send custom message and see the custom variable as blow.

action "Send Custom Message" {
  uses = "appleboy/telegram-action@master"
  secrets = [
    "TELEGRAM_TOKEN",
    "TELEGRAM_TO",
  ]
  args = "A new commit has been pushed. commit sha: {{ commit.sha }}"
}

Remove args to send the default message.

action "Send Default Message" {
  uses = "appleboy/telegram-action@master"
  secrets = [
    "TELEGRAM_TOKEN",
    "TELEGRAM_TO",
  ]
}

Environment variables

  • PHOTO - Optional. photo message
  • DOCUMENT - Optional. document message
  • STICKER - Optional. sticker message
  • AUDIO - Optional. audio message
  • VOICE - Optional. voice message
  • LOCATION - Optional. location message
  • VENUE - Optional. venue message
  • VIDEO - Optional. video message
  • DEBUG - Optional. enable debug mode
  • FORMAT - Optional. markdown or html

Example

action "Send photo message" {
  uses = "appleboy/telegram-action@master"
  secrets = [
    "TELEGRAM_TOKEN",
    "TELEGRAM_TO",
  ]
  env = {
    PHOTO = "tests/github.png"
  }
  args = "A new commit has been pushed."
}

Secrets

Getting started with Telegram Bot API.

  • TELEGRAM_TOKEN: Telegram authorization token.
  • TELEGRAM_TO: Unique identifier for this chat.

How to get unique identifier from telegram api:

$ curl https://api.telegram.org/bot<token>/getUpdates

See the result: (get chat id like 65382999)

{
  "ok": true,
  "result": [
    {
      "update_id": 664568113,
      "message": {
        "message_id": 8423,
        "from": {
          "id": 65382999,
          "is_bot": false,
          "first_name": "Bo-Yi",
          "last_name": "Wu (appleboy)",
          "username": "appleboy46",
          "language_code": "en"
        },
        "chat": {
          "id": 65382999,
          "first_name": "Bo-Yi",
          "last_name": "Wu (appleboy)",
          "username": "appleboy46",
          "type": "private"
        },
        "date": 1550333434,
        "text": "?"
      }
    }
  ]
}

Template variable

Github Variable Telegram Template Variable
GITHUB_REPOSITORY repo
GITHUB_ACTOR repo.namespace
GITHUB_SHA commit.sha
GITHUB_REF commit.ref
GITHUB_WORKFLOW github.workflow
GITHUB_ACTION github.action
GITHUB_EVENT_NAME github.event.name
GITHUB_EVENT_PATH github.event.path
GITHUB_WORKSPACE github.workspace

telegram-action's People

Contributors

appleboy avatar 0xflotus avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.