mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
refactor(generate-csv): update file paths from public to lankong_csv
This commit is contained in:
parent
81815e6986
commit
caec1217cb
2
.github/workflows/generate-csv.yml
vendored
2
.github/workflows/generate-csv.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
|||||||
- name: Copy and commit files
|
- name: Copy and commit files
|
||||||
run: |
|
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
|
# 配置 git
|
||||||
cd target-repo
|
cd target-repo
|
||||||
|
@ -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))
|
panic(fmt.Sprintf("Failed to create output directory: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,13 +60,13 @@ func main() {
|
|||||||
urls := fetchAllURLs(albumID, apiToken)
|
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 {
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||||
panic(fmt.Sprintf("Failed to create directory for %s: %v", csvPath, err))
|
panic(fmt.Sprintf("Failed to create directory for %s: %v", csvPath, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入CSV文件
|
// 写入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))
|
panic(fmt.Sprintf("Failed to write URLs to file %s: %v", csvPath, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user