From 0ccd16a33bd3e2193aa7b8f3fc87c0d193db2a93 Mon Sep 17 00:00:00 2001 From: Brijeshthummar02 Date: Wed, 26 Feb 2025 19:31:04 +0530 Subject: [PATCH] ci(markdownlint): Added GitHub workflow for auto-fixing Markdown lint violations Signed-off-by: Brijeshthummar02 --- .github/workflows/markdown-lint.yml | 39 ++++++++++++++++ .markdownlint.json | 70 +++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/markdown-lint.yml create mode 100644 .markdownlint.json diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml new file mode 100644 index 0000000000..7e69ec1606 --- /dev/null +++ b/.github/workflows/markdown-lint.yml @@ -0,0 +1,39 @@ +name: Markdown Lint & Auto-Fix + +on: + pull_request: + branches: + - main + +jobs: + markdown-lint: + name: Lint and Fix Markdown Files + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Markdownlint + run: | + sudo apt-get update + sudo apt-get install -y markdownlint-cli + + - name: Run Markdownlint & Auto-Fix + run: | + markdownlint '**/*.md' --fix + + - name: Commit Changes (if any) + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + if git diff --cached --quiet; then + echo "No changes to commit" + else + git commit -m "chore: Auto-fix Markdown lint issues" + git push origin ${{ github.head_ref }} + fi diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000000..cff006be91 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,70 @@ +{ + "code-block-style": { + "style": "fenced" + }, + "code-fence-style": { + "style": "backtick" + }, + "emphasis-style": { + "style": "asterisk" + }, + "extended-ascii": { + "ascii-only": true + }, + "fenced-code-language": { + "allowed_languages": [ + "bash", + "html", + "javascript", + "json", + "markdown", + "text", + "go" + ], + "language_only": true + }, + "heading-style": { + "style": "atx" + }, + "hr-style": { + "style": "---" + }, + "line-length": { + "strict": true, + "code_blocks": false + }, + "link-image-style": { + "collapsed": false, + "shortcut": false, + "url_inline": false + }, + "no-duplicate-heading": { + "siblings_only": true + }, + "ol-prefix": { + "style": "ordered" + }, + "proper-names": { + "code_blocks": false, + "names": [ + "Cake.Markdownlint", + "CommonMark", + "JavaScript", + "Markdown", + "markdown-it", + "markdownlint", + "Node.js", + "Go" + ] + }, + "reference-links-images": { + "shortcut_syntax": true + }, + "strong-style": { + "style": "asterisk" + }, + "ul-style": { + "style": "dash" + } + } + \ No newline at end of file