Update README.md #49
Workflow file for this run
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
# .github/workflows/prettier-check.yml | |
name: Prettier Markdown Check | |
on: | |
push: | |
branches: ["**"] | |
paths: | |
- "**/*.md" | |
pull_request: | |
branches: ["**"] | |
paths: | |
- "**/*.md" | |
jobs: | |
prettier: | |
name: Check Markdown Formatting with Prettier | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js environment | |
# Prettier requires Node.js to run | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
# with: | |
# node-version: "20" # Optional: Remove this line to eliminate deprecation warning | |
# Step 3: Install Prettier Globally | |
- name: Install Prettier | |
run: npm install -g prettier | |
# Step 4: Run Prettier Check on Markdown Files | |
- name: Run Prettier Check | |
run: | | |
prettier --check "**/*.md" | |
# Optional Step 5: Display Formatted Files | |
- name: Show Unformatted Files | |
if: failure() | |
run: | | |
echo "The following Markdown files are not properly formatted:" | |
prettier --list-different "**/*.md" | |
# Step 6: try auto fix | |
- name: Auto Fix | |
if: failure() | |
run: | | |
prettier --write "**/*.md" | |
- name: Commit and Push | |
if: failure() | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add . | |
git commit -m "Fix markdown formatting" | |
git push |