random-api-go/.github/workflows/generate-csv.yml

57 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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