fix: docs edit link #1478
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: 🎀 Code Format (Verification) | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
jobs: | |
code-format: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref || github.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Code format check | |
id: fmt_check | |
continue-on-error: true | |
run: | | |
if ! npm run fmt:check; then | |
echo "exit_code=1" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Auto-format (Markdown files) | |
if: steps.fmt_check.outputs.exit_code != '0' && github.event_name == 'pull_request' | |
run: npx prettier --write "src/**/*.{md,mdx}" | |
- name: Commit formatted (Markdown files) | |
if: steps.fmt_check.outputs.exit_code != '0' && github.event_name == 'pull_request' | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
if [[ -n "$(git status --porcelain)" ]]; then | |
git add . | |
if git commit -m "chore: 🤖 code format" --no-verify; then | |
git push | |
else | |
echo "🦖 Skipped! No changes to commit..." | |
fi | |
else | |
echo "🦖 Skipped! No changes found." | |
fi |