chore(workflow): auto update CSV files by GitHub Actions

This commit is contained in:
wood chen 2024-10-27 12:00:38 +08:00
parent 81815e6986
commit 4c2309e83f

View File

@ -35,21 +35,20 @@ jobs:
- name: Copy and commit files - name: Copy and commit files
run: | run: |
# 复制文件 # 创建目标目录
cp -rv public/* target-repo/random-api.czl.net/url/pic/ 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/ \;
# 配置 git
cd target-repo cd target-repo
git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]" git config --local user.name "github-actions[bot]"
# 设置远程仓库URL使用token认证
git remote set-url origin https://${{ secrets.TARGET_REPO_TOKEN }}@github.com/woodchen-ink/github-file.git git remote set-url origin https://${{ secrets.TARGET_REPO_TOKEN }}@github.com/woodchen-ink/github-file.git
# 添加并提交更改
git add . git add .
git commit -m "Update CSV files [skip ci]" || echo "No changes to commit" # 删除 [skip ci] 标记
git commit -m "Auto update CSV files by GitHub Actions" || echo "No changes to commit"
# 推送更改
git push origin main git push origin main