首页 > 解决方案 > Github Actions:缺少电报令牌或用户列表

问题描述

每次有人推送给 repo 的主人时,我都在尝试使用 Github Actions 发送 Telegram 消息。但是使用此操作会导致以下错误并且操作失败:

missing telegram token or user list

这是我的 yml 文件:

name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Telegram Notify
        uses: appleboy/telegram-action@0.0.3
        with:
          to: ${{ secrets.TELEGRAM_CHAT_ID }}
          token: ${{ secrets.TELEGRAM_TOKEN }}
          message: |
            An event occured in ${{ github.repository    }} repository.
            ${{ github.event_name }}

我是 Github Actions 的新手。我应该怎么做才能解决这个问题?

PS:我已将 telegram_token 和 telegram_chat_id 添加到 repo 的 secrets 部分。

标签: telegramgithub-actions

解决方案


转到 repo 设置并设置 TELEGRAM_CHAT_ID 和 TELEGRAM_TOKEN 的机密。设置 TELEGRAM_TOKEN 的机密时,请确保使用机器人令牌https://api.telegram.org/bot /METHOD_NAME 将查询发送到 Telegram Bot API,例如https://api.telegram.org/bot19023205:BNF -23dred1234ghIkl-dre4fdgr8nv1w4od/getMe


推荐阅读