-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.43 KB
/
Copy pathsend_to_telegram.yml
File metadata and controls
49 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Send posts to Telegram
on:
push:
branches:
- main
paths:
- 'content/**'
workflow_dispatch:
jobs:
telegram:
runs-on: ubuntu-latest
steps:
- name: Checkout repo (shallow by date)
uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Run Telegram post script (only changed Markdown files)
env:
TELEGRAM_CHAT_ID_RU: ${{ vars.TELEGRAM_CHAT_ID_RU }}
TELEGRAM_BOT_TOKEN_RU: ${{ secrets.TELEGRAM_BOT_TOKEN_RU }}
run: |
source venv/bin/activate
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.md$' || true)
for file in $CHANGED_FILES; do
python telegram-data/post_to_telegram.py "$file"
done
- name: Commit updated telegram_mappings.csv
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add telegram-data/telegram_mappings.csv
git commit -m "Update telegram_mappings.csv after Telegram sync" || echo "No changes to commit"
git push