Telegram Auto Sign #17
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: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| run-checkin: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - 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: 提交日志到 logs 分支 | |
| run: | | |
| # 配置 Git 身份 | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| # 临时保存生成的日志文件内容 | |
| LOG_CONTENT=$(cat checkin.log) | |
| # 切换到 logs 分支 | |
| git checkout logs || git checkout -b logs | |
| # 将刚才运行生成的日志写回文件 | |
| echo "$LOG_CONTENT" > checkin.log | |
| # 提交并推送 | |
| git add checkin.log | |
| git commit -m "Auto check-in log update: $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit" | |
| git push origin logs |