feat[ptr]: 默认情况下,Form 对在里面的所有的 Input 都传递了 handleChange, 当其中一个变化时,直接修改… #66
This file contains hidden or 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: Auto Update README | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # 添加写权限 | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| # 检查推送中的所有提交是否包含 [ptr] | |
| - name: Check for [ptr] in commits | |
| id: check_ptr | |
| run: | | |
| echo "Checking commits for [ptr] marker..." | |
| echo "Before: ${{ github.event.before }}" | |
| echo "After: ${{ github.sha }}" | |
| # 获取所有推送的提交消息 | |
| COMMITS=$(git log --format=%B ${{ github.event.before }}..${{ github.sha }} 2>/dev/null || git log --format=%B -1) | |
| echo "Commits:" | |
| echo "$COMMITS" | |
| if echo "$COMMITS" | grep -q "\[ptr\]"; then | |
| echo "Found [ptr] marker!" | |
| echo "has_ptr=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No [ptr] marker found" | |
| echo "has_ptr=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update README | |
| if: steps.check_ptr.outputs.has_ptr == 'true' | |
| env: | |
| COMMIT_SHA: ${{ github.sha }} | |
| REPO_URL: ${{ github.server_url }}/${{ github.repository }} | |
| BEFORE_SHA: ${{ github.event.before }} | |
| run: node scripts/update-readme.js | |
| - name: Commit changes | |
| if: steps.check_ptr.outputs.has_ptr == 'true' | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: "docs: auto update README [skip ci]" | |
| file_pattern: README.md |