-
Notifications
You must be signed in to change notification settings - Fork 2
38 lines (31 loc) · 1.03 KB
/
main.yml
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
name: Fetch Telegram Channel Posts
on:
workflow_dispatch: # Allow manual triggering
schedule:
- cron: '0 */6 * * *' # Run every 6 hours
jobs:
fetch-posts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install python-telegram-bot requests
- name: Fetch Telegram Channel Posts
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
CHANNEL_USERNAME: ${{ secrets.CHANNEL_USERNAME }}
run: python bot/main.py
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add public/data/posts.json public/media/*
git commit -m "Update Telegram channel posts" || echo "No changes to commit"
git push