Instant telegram notification if GitHub is Stared
I really like the sense of achievement obtained by open source projects. In the past year, I have insisted on doing several open source projects, and I have also gained some stars from netizens, some also add WeChat, raise requirements, the charm of open source is here.
For example, if someone stars your project, it would be better to be able to receive telegram notifications in time, because the NPM package release notification has been done before, so this is easy to do, but because there are still some pitfalls, so mark here, maybe help some friends.
Configuration
1 | on: |
Configuration Instructions
There are many variables in GitHub Action, ${{ github.event.repository.name }}
, ${{github.repository}}
are context variables, which do not need to be configured, use directly, ${ { secrets.TELEGRAM_TO }}
is a warehouse configuration variable, which needs to be set in the warehouse settings.
GITHUB_SERVER_URL is not Work?
The official website has said that the default environment variable is $GITHUB_SERVER_URL
, and the usage method is $GITHUB_SERVER_URL
, but if it is written in the above message, it will not work, the reason is that the environment variable is used when using the shell, if it is a job The github context needs to be used in the step
Telegram Configuration Parameter Acquisition
TELEGRAM_TOKEN
- Through @BotFather, create a Bot to obtain, note that the complete format of the Token will be like this
12345678:BBFntuCD6nRx1ZIYZ-eCyfP1UO4FeAjnz2M
- Through @BotFather, create a Bot to obtain, note that the complete format of the Token will be like this
TELEGRAM_TO
Need to send a message to the bot, make sure chat is turned on
Visit
https://api.telegram.org/bot$TELEGRAM_TOKEN/getUpdates
to get the chatID in it
Write at the End
As above, you can realize the telegram notification, start!