Skip to content

ci: delete the check for non-main branch #47

ci: delete the check for non-main branch

ci: delete the check for non-main branch #47

Workflow file for this run

name: Lint
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
paths:
- '**/*.md' # Only run on Markdown file changes
jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history to allow Git operations
- 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 and push 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]"
git push origin HEAD
# - name: Create Pull Request (if on non-main branch)
# if: github.ref != 'refs/heads/main' && 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 }}.