Telegram Auto Sign #7
This file contains hidden or 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: Telegram Auto Sign | |
| on: | |
| schedule: | |
| # 每天 UTC 时间 0点(北京时间早上 8 点)运行 | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| # ⚠️ 必须加上这个权限,Action 才能修改仓库里的文件并提交 | |
| permissions: | |
| contents: write | |
| jobs: | |
| run-checkin: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v3 | |
| - name: 配置 Python 环境 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: 安装依赖 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install telethon | |
| - name: 运行签到脚本 | |
| env: | |
| API_ID: ${{ secrets.API_ID }} | |
| API_HASH: ${{ secrets.API_HASH }} | |
| SESSION_STRING: ${{ secrets.SESSION_STRING }} | |
| BOT_USERNAME: ${{ secrets.BOT_USERNAME }} | |
| run: python main.py | |
| - name: 提交并推送日志 (Commit and Push) | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add checkin.log | |
| # 如果日志有更新就 commit,如果没有变化就跳过不报错 | |
| git commit -m "Auto check-in log update" || echo "No changes to commit" | |
| git push |