refactor(generate-csv): update file paths from public to lankong_csv

This commit is contained in:
wood chen 2024-10-27 12:07:51 +08:00
parent 81815e6986
commit caec1217cb
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ jobs:
- name: Copy and commit files
run: |
# 复制文件
cp -rv public/* target-repo/random-api.czl.net/url/pic/
cp -rv lankong_csv/* target-repo/random-api.czl.net/url/pic/
# 配置 git
cd target-repo

View File

@ -50,7 +50,7 @@ func main() {
}
// 创建输出目录
if err := os.MkdirAll("public", 0755); err != nil {
if err := os.MkdirAll("lankong_csv", 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("public", csvPath))
dir := filepath.Dir(filepath.Join("lankong_csv", 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("public", csvPath)); err != nil {
if err := writeURLsToFile(urls, filepath.Join("lankong_csv", csvPath)); err != nil {
panic(fmt.Sprintf("Failed to write URLs to file %s: %v", csvPath, err))
}
}