README.md (1516B)
1 # Midnight Build with Telegram Notifications 2 3 Schedule a nightly build at midnight and push pass/fail status to a Telegram 4 chat. 5 6 ## How it works 7 8 The file `.jci/crontab` contains a single cron entry: 9 10 ``` 11 0 0 * * * run 12 ``` 13 14 This tells Jaypore CI to execute `.jci/run.sh` every day at midnight. 15 16 To install (or update) this schedule into the system crontab, run: 17 18 ```bash 19 git jci cron sync 20 ``` 21 22 `cron sync` reads `.jci/crontab`, translates each line into a real crontab 23 entry that invokes `git jci run` inside the repository, and writes it to the 24 current user's crontab. Run the command again after changing `.jci/crontab` to 25 pick up new schedules. 26 27 ## Setting up Telegram 28 29 1. Create a bot via [BotFather](https://t.me/BotFather) and note the **bot 30 token**. 31 2. Get your **chat ID** by sending a message to the bot and visiting 32 `https://api.telegram.org/bot<TOKEN>/getUpdates`. 33 3. Export both values so Jaypore CI can see them at runtime: 34 35 ```bash 36 export TELEGRAM_BOT_TOKEN="123456:ABC-DEF..." 37 export TELEGRAM_CHAT_ID="-100..." 38 ``` 39 40 You can persist these in `~/.bashrc`, a `.env` file sourced by your shell, or 41 whatever secrets mechanism you prefer. 42 43 ## What the build does 44 45 1. `cd` into the repo root. 46 2. Run `python3 manage.py test core` and capture the exit code. 47 3. Save test output and exit code to `$JCI_OUTPUT_DIR`. 48 4. Send a Telegram message with the repo name, short commit hash, pass/fail 49 status, and timestamp. 50 5. Exit with the test exit code so Jaypore CI records the run as passed or 51 failed.