Merge pull request #1 from fe-dudu/diff-20250208124405 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check diff (daily) | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 23 * * 0-4' | |
workflow_dispatch: | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/pnpm-setup-node | |
- run: pnpm install --frozen-lockfile | |
- name: Run command and check for changes | |
run: | | |
pnpm generate-type | |
git diff > diff.patch | |
if [ -s diff.patch ]; then | |
pnpm rimraf ./diff.patch | |
git config --global user.name "fe-dudu" | |
git config --global user.email "[email protected]" | |
timestamp=$(date +'%Y%m%d%H%M%S') | |
branch_name="diff-${timestamp}" | |
git checkout -b $branch_name | |
git add . | |
git commit -m "There have been changes to the API type" | |
git push origin $branch_name | |
gh pr create --title "API type change" --body "This is a PR created by GitHub Actions." --base main --head $branch_name | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |