name: Generate CSV Files on: push: paths: - lankong_tools/album_mapping.json schedule: - cron: '0 */4 * * *' workflow_dispatch: inputs: message: description: 'Trigger message' required: false default: 'Manual trigger to generate CSV files' jobs: generate: runs-on: ubuntu-latest steps: - name: Checkout source repo uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.23' - name: Generate CSV files run: | go run lankong_tools/generate_csv.go env: API_TOKEN: ${{ secrets.API_TOKEN }} - name: Checkout target repo uses: actions/checkout@v4 with: repository: woodchen-ink/github-file token: ${{ secrets.TARGET_REPO_TOKEN }} path: target-repo - name: Copy and commit files run: | # 删除不需要的文件和目录 rm -f public/index.html public/index.md rm -rf public/css # 创建目标目录 mkdir -p target-repo/random-api.czl.net/url/pic # 复制所有CSV文件到pic目录 find public -name "*.csv" -exec cp -v {} target-repo/random-api.czl.net/url/pic/ \; cd target-repo git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git remote set-url origin https://${{ secrets.TARGET_REPO_TOKEN }}@github.com/woodchen-ink/github-file.git git add . git commit -m "Auto update CSV files by GitHub Actions" || echo "No changes to commit" git push origin main