diff --git a/.github/workflows/generate-csv.yml b/.github/workflows/generate-csv.yml index 8e20459..a3a85ea 100644 --- a/.github/workflows/generate-csv.yml +++ b/.github/workflows/generate-csv.yml @@ -35,22 +35,23 @@ jobs: - name: Copy and commit files run: | - # 复制文件 - cp -rv lankong_csv/* target-repo/random-api.czl.net/url/pic/ + # 删除不需要的文件和目录 + 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/ \; - # 配置 git cd target-repo git config --local user.email "github-actions[bot]@users.noreply.github.com" 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 add . - # 允许CI [skip ci] - git commit -m "Github Bot Update CSV files " || echo "No changes to commit" - - # 推送更改 + git commit -m "Auto update CSV files by GitHub Actions" || echo "No changes to commit" git push origin main - + \ No newline at end of file diff --git a/lankong_tools/generate_csv.go b/lankong_tools/generate_csv.go index b162e41..c4d157b 100644 --- a/lankong_tools/generate_csv.go +++ b/lankong_tools/generate_csv.go @@ -50,7 +50,7 @@ func main() { } // 创建输出目录 - if err := os.MkdirAll("lankong_csv", 0755); err != nil { + if err := os.MkdirAll("public", 0755); err != nil { panic(fmt.Sprintf("Failed to create output directory: %v", err)) } @@ -60,13 +60,13 @@ func main() { urls := fetchAllURLs(albumID, apiToken) // 确保目录存在 - dir := filepath.Dir(filepath.Join("lankong_csv", csvPath)) + dir := filepath.Dir(filepath.Join("public", csvPath)) if err := os.MkdirAll(dir, 0755); err != nil { panic(fmt.Sprintf("Failed to create directory for %s: %v", csvPath, err)) } // 写入CSV文件 - if err := writeURLsToFile(urls, filepath.Join("lankong_csv", csvPath)); err != nil { + if err := writeURLsToFile(urls, filepath.Join("public", csvPath)); err != nil { panic(fmt.Sprintf("Failed to write URLs to file %s: %v", csvPath, err)) } }