update ch3 sec1 subsec1 3 #147
Workflow file for this run
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: Lint | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
paths: | |
- '**/*.md' | |
# 添加权限声明 | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
markdown-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
persist-credentials: true | |
- name: Debug info | |
run: | | |
echo "PR head ref: ${{ github.event.pull_request.head.ref || 'N/A' }}" | |
echo "Current ref: ${{ github.ref }}" | |
- name: Lint | |
continue-on-error: true | |
run: | | |
curl -fsSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh | |
autocorrect --fix | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git diff --quiet; then | |
echo "No changes detected." | |
echo "has_changes=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "Changes detected. Preparing to commit..." | |
echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Commit changes | |
if: steps.check_changes.outputs.has_changes == 'true' | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add -A | |
git commit -m "Auto fix formatting by autocorrect [ci skip]" | |
- name: Push changes | |
if: steps.check_changes.outputs.has_changes == 'true' | |
run: git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref }} | |
continue-on-error: true | |
- name: Create Pull Request | |
if: steps.check_changes.outputs.has_changes == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: "Auto fix formatting by autocorrect [ci skip]" | |
branch: auto-fix-${{ github.run_number }} | |
delete-branch: true | |
title: "Auto fix formatting by autocorrect" | |
body: | | |
This PR contains automatic fixes by the `autocorrect` tool. | |
Generated by GitHub Actions run ${{ github.run_number }}. |