Run fdip.py #114
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: Run fdip.py | |
on: | |
schedule: | |
- cron: "10 * * * *" # 每小时的第10分钟执行 | |
timezone: Asia/Shanghai # 添加时区配置 | |
workflow_dispatch: # 允许手动触发 | |
jobs: | |
run-tcip: | |
runs-on: ubuntu-latest | |
env: | |
TZ: Asia/Shanghai # 设置为你本地的时区 | |
permissions: | |
contents: write # 确保有权限推送代码 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" # 根据需要调整Python版本 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt # 确保requirements.txt包含所有依赖 | |
pip install telethon python-dotenv pathlib2 | |
- name: Set up environment variables | |
run: | | |
touch .env | |
echo "API_ID=${{ secrets.API_ID }}" >> .env | |
echo "API_HASH=${{ secrets.API_HASH }}" >> .env | |
echo "SESSION_NAME=${{ secrets.SESSION_NAME }}" >> .env | |
echo "TELEGRAM_PROXY=${{ secrets.TELEGRAM_PROXY }}" >> .env | |
- name: Run fdip.py | |
run: python fdip.py | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
if git diff --quiet; then | |
echo "No changes to commit." | |
else | |
git add . | |
git commit -m "cfst: Auto-update fdip.txt on $(date +'%Y-%m-%d %H:%M:%S')" | |
git push origin main | |
fi |