feat: hash处理骰子筛选 #361
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 }}" | |
| # 获取所有推送的提交消息(包括合并提交中的所有提交) | |
| # 使用 --first-parent 避免重复检查,使用 --all-match 确保准确性 | |
| if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then | |
| # 首次推送或强制推送 | |
| COMMITS=$(git log --format=%B -1) | |
| else | |
| # 正常推送,获取本次push的所有提交(包括合并进来的提交) | |
| COMMITS=$(git log --format=%B ${{ github.event.before }}..${{ github.sha }}) | |
| fi | |
| 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.mjs | |
| - 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 |