mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 13:52:02 +08:00
57 lines
1.5 KiB
YAML
57 lines
1.5 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
|
||
|
||
- name: Copy and commit files
|
||
run: |
|
||
# 复制文件
|
||
cp -rv lankong_csv/* 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 push origin main
|
||
|