Skip to content

feat: Add friends page, friend data, and auto-PR workflow. #3

feat: Add friends page, friend data, and auto-PR workflow.

feat: Add friends page, friend data, and auto-PR workflow. #3

name: Generate Git History JSON
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整提交历史
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: Generate Git History Data
run: pnpm run git
- name: Commit Updated JSON Files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src/json/build-info.json src/json/git-history.json
# 如果没有变化则不提交避免报错
git diff --staged --quiet || git commit -m "chore(git-info): auto-update git history JSON data"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}