2021-07-31 20:04:12 +00:00
|
|
|
# GitHub release bot
|
2021-08-31 18:53:21 +00:00
|
|
|
Telegram bot for GitHub releases notification. Bot simply fetches latest release or tag and send notification.
|
2021-07-31 20:04:12 +00:00
|
|
|
|
|
|
|
**Warning**: GitHub will ban you with small interval and spread time. Use adequate interval and spread time or use TOR.
|
|
|
|
|
|
|
|
Interval - set how often check GitHub for new releases in seconds. Default - 28800 seconds (8 hours).
|
|
|
|
|
|
|
|
Spread - time in seconds for random offset calculation per repo within interval.
|
|
|
|
Default 600 seconds (10 minutes). Offset calculated as RANDOM(u64) % SPREAD.
|
|
|
|
|
|
|
|
With default values bot will launch main loop check every 8 hours and get latest release within (RANDOM(u64) % 600) seconds per repo.
|
|
|
|
|
|
|
|
## Example config.yaml
|
|
|
|
```yaml
|
|
|
|
- owner: kubernetes-sigs
|
|
|
|
repo: kubespray
|
2021-08-31 18:53:21 +00:00
|
|
|
check: release
|
|
|
|
- owner: nextcloud
|
|
|
|
repo: server
|
|
|
|
check: tag
|
2021-07-31 20:04:12 +00:00
|
|
|
```
|
|
|
|
## Binary
|
|
|
|
### Build binary
|
|
|
|
```ShellSession
|
|
|
|
cargo build --release
|
|
|
|
```
|
|
|
|
### Run binary
|
|
|
|
```ShellSession
|
|
|
|
github-release-bot \
|
|
|
|
--token ${TOKEN} --chatid ${CHATID} \
|
|
|
|
--config ${CONFIG} --datadir ${DATADIR} \
|
|
|
|
--interval ${INTERVAL} --spread ${SPREAD}
|
|
|
|
```
|
|
|
|
### Binary params
|
|
|
|
- token - required, Telegram token
|
|
|
|
- chatid - required, Telegram chat id
|
|
|
|
- config - file required, default config file name "config.yaml"
|
|
|
|
- interval - optional, default 28800 seconds (8 hours)
|
|
|
|
- spread - optional, default 600 seconds (10 minutes)
|
|
|
|
- datadir - optional, dir for storing files with latest releases, default "data"
|
|
|
|
|
|
|
|
## Docker
|
|
|
|
### Docker run
|
|
|
|
```ShellSession
|
2021-08-01 12:05:34 +00:00
|
|
|
docker run -d -v ./config.yaml:/opt/config.yaml -v ./data:/opt/data registry.geekhome.org/ghp/github-release-bot:latest \
|
2021-07-31 20:04:12 +00:00
|
|
|
-e TOKEN=${TOKEN} -e CHATID=${CHATID} \
|
|
|
|
-e CONFIG=${CONFIG} -e DATADIR=${DATADIR} \
|
|
|
|
-e INTERVAL=${INTERVAL} -e SPREAD=${SPREAD}
|
|
|
|
```
|
2021-08-01 12:05:34 +00:00
|
|
|
### Docker build
|
|
|
|
```ShellSession
|
|
|
|
make build
|
|
|
|
```
|
2021-07-31 20:04:12 +00:00
|
|
|
### Docker params
|
|
|
|
OS ENV used to pass arguments:
|
|
|
|
- TOKEN - required, Telegram token
|
|
|
|
- CHATID - required, Telegram chat id
|
|
|
|
- CONFIG - file required, default config file name "config.yaml"
|
|
|
|
- INTERVAL - optional, default 28800 seconds (8 hours)
|
|
|
|
- SPREAD - optional, default 600 seconds (10 minutes)
|
|
|
|
- DATADIR - optional, dir for storing files with latest releases, default "data"
|
|
|
|
|
|
|
|
|