mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 05:42:01 +08:00
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
name: Generate CSV Files
|
|
|
|
on:
|
|
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
|
|
persist-credentials: false
|
|
|
|
- name: Debug target repo access
|
|
run: |
|
|
cd target-repo
|
|
git remote -v
|
|
git status
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.TARGET_REPO_TOKEN }}
|
|
|
|
- name: Copy and commit files
|
|
run: |
|
|
# 显示源文件
|
|
echo "Source files:"
|
|
ls -la public/
|
|
|
|
# 创建目标目录
|
|
mkdir -p target-repo/random-api.czl.net/url
|
|
|
|
# 复制文件
|
|
cp -rv public/* target-repo/random-api.czl.net/url/
|
|
|
|
# 显示目标文件
|
|
echo "Target files:"
|
|
ls -la target-repo/random-api.czl.net/url/
|
|
|
|
# 提交更改
|
|
cd target-repo
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
git add .
|
|
git status
|
|
git commit -m "Update CSV files [skip ci]" || echo "No changes to commit"
|
|
git push || (echo "Push failed with status $?" && exit 1)
|
|
|