Sync IDF Messages #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync IDF Messages | |
on: | |
schedule: | |
- cron: '0 1 * * *' # Runs daily at 1 AM UTC | |
workflow_dispatch: | |
jobs: | |
sync-telegram: | |
runs-on: ubuntu-latest | |
environment: Telegram | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install OpenSSL | |
run: | | |
sudo apt-get update -q | |
sudo apt-get install -y openssl | |
openssl version | |
- name: Decode and decrypt Telegram session file | |
run: | | |
echo "${{ secrets.TELEGRAM_SESSION_ENC }}" | base64 --decode > user_session.session.enc | |
openssl enc -aes-256-cbc -pbkdf2 -iter 100000 -d -in user_session.session.enc -out user_session.session -k "${{ secrets.ENCRYPTION_PASSWORD }}" | |
echo "Decryption successful!" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Cache Python dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install --no-cache-dir -r requirements.txt | |
- name: Run IDF Telegram scraping script | |
env: | |
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }} | |
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }} | |
R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }} | |
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }} | |
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }} | |
R2_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
python export_idf_telegram.py | |
# - name: Run Tzevaadomm Telegram scraping script | |
# env: | |
# TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }} | |
# TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }} | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: | | |
# python export_tzevaadomm_telegram.py | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "${{ secrets.GIT_USER_NAME }}" | |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | |
git add . | |
git commit -m "Sync Telegram messages [$(date -u)]" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |