name: Run Python Script and Push on: push: branches: - main jobs: run-python-and-push: runs-on: ubuntu-latest steps: # 步骤 1: 克隆当前仓库 - name: Checkout current repository uses: actions/checkout@v3 # 步骤 2: 设置 Python 环境 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.12' # 步骤 3: 安装依赖(如果有) - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y libjpeg-dev zlib1g-dev python -m pip install --upgrade pip pip install -r requirements.txt # 步骤 4: 运行 Python 脚本 - name: Run Python script run: | mkdir index python g.py # 步骤 5: 克隆目标仓库 - name: Checkout target repository uses: actions/checkout@v3 with: repository: jkjoy/photos path: target-repo token: ${{ secrets.TOKEN }} # 步骤 6: 将生成的文件复制到目标仓库 - name: Copy generated files to target repository run: | cp -r index/* target-repo/ cp -r assets/ target-repo/ cp -r images/ target-repo/ # 步骤 7: 提交并推送更改到目标仓库 - name: Commit and push changes to target repository run: | cd target-repo git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add -f . git commit -m "Automated commit by GitHub Actions" git push