From 23eb69495b1e9d6121ec6498feca681ae28d9faa Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Thu, 7 Aug 2025 14:37:49 -0700 Subject: [PATCH 1/4] add markdownlint --- .github/linters/.markdownlint.yml | 51 -------------------------- .github/linters/.yaml-lint.yml | 59 ------------------------------- .github/super-linter.env | 6 ---- .github/workflows/lint-md.yml | 24 +++++++++++++ .markdownlint.json | 9 +++++ .markdownlint.yml | 1 - .markdownlintignore | 4 +++ package.json | 4 +-- 8 files changed, 39 insertions(+), 119 deletions(-) delete mode 100644 .github/linters/.markdownlint.yml delete mode 100644 .github/linters/.yaml-lint.yml delete mode 100644 .github/super-linter.env create mode 100644 .github/workflows/lint-md.yml create mode 100644 .markdownlint.json delete mode 120000 .markdownlint.yml create mode 100644 .markdownlintignore diff --git a/.github/linters/.markdownlint.yml b/.github/linters/.markdownlint.yml deleted file mode 100644 index 7c89f2e2..00000000 --- a/.github/linters/.markdownlint.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -########################### -########################### -## Markdown Linter rules ## -########################### -########################### - -# Linter rules doc: -# - https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md -# -# Note: -# To comment out a single error: -# -# any violations you want -# -# - -# Default state for all rules -default: false - -################# -# Rules by tags # -################# -blanks-around-fences: true # Fenced code blocks should be surrounded by blank lines -blanks-around-headings: true # Headings should be surrounded by blank lines -blanks-around-lists: true # Lists should be surrounded by blank lines -code-block-style: - style: "fenced" -code-fence-style: - style: "backtick" -emphasis-style: - style: "consistent" -fenced-code-language: true # Fenced code blocks should have a language specified -heading-start-left: true # Headings must start at the beginning of the line -heading-style: - style: "atx" -hr-style: true # Horizontal rule style -list-indent: true # Inconsistent indentation for list items at the same level -no-empty-links: true -no-missing-space-atx: true # No space after hash on atx style heading -no-multiple-blanks: true # Multiple consecutive blank lines -no-reversed-links: true -no-space-in-code: true -no-space-in-emphasis: true -no-space-in-links: true -no-trailing-spaces: true -single-trailing-newline: true # Files should end with a single newline character -strong-style: - style: "consistent" -ul-style: - style: "consistent" diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml deleted file mode 100644 index b10948eb..00000000 --- a/.github/linters/.yaml-lint.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -########################################### -# These are the rules used for # -# linting all the yaml files in the stack # -# NOTE: # -# You can disable line with: # -# # yamllint disable-line # -########################################### -rules: - braces: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - brackets: - level: warning - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: 1 - max-spaces-inside-empty: 5 - colons: - level: warning - max-spaces-before: 0 - max-spaces-after: 1 - commas: - level: warning - max-spaces-before: 0 - min-spaces-after: 1 - max-spaces-after: 1 - comments: disable - comments-indentation: disable - document-end: disable - document-start: - level: warning - present: true - empty-lines: - level: warning - max: 2 - max-start: 0 - max-end: 0 - hyphens: - level: warning - max-spaces-after: 1 - indentation: - level: warning - spaces: consistent - indent-sequences: true - check-multi-line-strings: false - key-duplicates: enable - line-length: - level: warning - max: 100 - allow-non-breakable-words: true - allow-non-breakable-inline-mappings: true - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: disable diff --git a/.github/super-linter.env b/.github/super-linter.env deleted file mode 100644 index feebdd46..00000000 --- a/.github/super-linter.env +++ /dev/null @@ -1,6 +0,0 @@ -IGNORE_GITIGNORED_FILES=true -VALIDATE_GITLEAKS=true -VALIDATE_MARKDOWN=true -MARKDOWN_CONFIG_FILE=.markdownlint.yml -VALIDATE_YAML=true -VALIDATE_JSON=true diff --git a/.github/workflows/lint-md.yml b/.github/workflows/lint-md.yml new file mode 100644 index 00000000..35105497 --- /dev/null +++ b/.github/workflows/lint-md.yml @@ -0,0 +1,24 @@ +name: Lint Markdown + +on: + pull_request: + paths: + - '**/*.md' + +jobs: + markdownlint: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install markdownlint-cli + run: npm install -g markdownlint-cli + + - name: Run markdownlint + run: markdownlint "**/*.md" --config .markdownlint.json diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000..d1601fcc --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,9 @@ +{ + "default": false, + "MD025": { + "severity": "warning" + }, + "MD033": { + "severity": "error" + } +} diff --git a/.markdownlint.yml b/.markdownlint.yml deleted file mode 120000 index d709e3e4..00000000 --- a/.markdownlint.yml +++ /dev/null @@ -1 +0,0 @@ -.github/linters/.markdownlint.yml \ No newline at end of file diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..becf9d59 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,4 @@ +node_modules/ +dist/ +CHANGELOG.md +docs/old/ diff --git a/package.json b/package.json index ff531c8d..33291f31 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "build": "gatsby build", "serve": "gatsby serve", "clean": "gatsby clean", - "lint": "docker run --rm -e RUN_LOCAL=true --env-file '.github/super-linter.env' -v \"$PWD\":/tmp/lint github/super-linter:slim-v4.10.1", + "lint:md": "markdownlint '**/*.md' --config .markdownlint.json", "buildNavigation": "npx --yes github:AdobeDocs/adp-devsite-utils buildNavigation -v", "buildRedirections": "npx --yes github:AdobeDocs/adp-devsite-utils buildRedirections -v", "renameFiles": "npx --yes github:AdobeDocs/adp-devsite-utils renameFiles -v", @@ -47,7 +47,7 @@ "devDependencies": { "express": "5.1.0", "glob": "11.0.0", - "markdown-link-check": "^3.13.7", + "markdownlint-cli": "^0.39.0", "remark-cli": "^11.0.0", "remark-validate-links": "^12.1.0" } From c57c94939419e663b5688b86005f212c91802b9d Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Thu, 7 Aug 2025 15:08:56 -0700 Subject: [PATCH 2/4] update --- .github/workflows/test-pull-request.yml | 31 ++++++++----------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 5be49b28..eee5da72 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -45,21 +45,6 @@ jobs: - name: Load Super Linter Environment run: cat ".github/super-linter.env" >> "$GITHUB_ENV" - ################################ - # Run Linters against code base # - ################################ - - name: Lint Code Base - # - # Use full version number to avoid cases when a next - # released version is buggy - # About slim image: https://github.com/github/super-linter#slim-image - uses: github/super-linter/slim@v4.10.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEFAULT_BRANCH: main - VALIDATE_ALL_CODEBASE: false - VALIDATE_GITHUB_ACTIONS: true - - name: Setup Node v16 for Yarn v3 uses: actions/setup-node@v3 with: @@ -80,6 +65,10 @@ jobs: with: cmd: install + - name: Lint Markdown files + with: + cmd: lint:md + - name: Check internal links uses: borales/actions-yarn@v3 with: @@ -104,10 +93,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18' - + - name: Enable Corepack for Yarn v3 run: corepack enable - + - name: Install Yarn v3 uses: borales/actions-yarn@v3 with: @@ -132,22 +121,22 @@ jobs: YARN_ENABLE_HARDENED_MODE: false with: cmd: install --mode=update-lockfile - + - name: Run PR script run: node src/pr-scripts.js env: PR_ID: ${{ github.event.pull_request.number }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - name: Run AI metadata generation script run: node src/ai-scripts.js env: AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} FILE_NAME: "pr_content.txt" - + - name: Run review PR script run: node src/review-scripts.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_ID: ${{ github.event.pull_request.number }} \ No newline at end of file + PR_ID: ${{ github.event.pull_request.number }} From e96d0318768046c93b6d0247da6c640fb2c3e571 Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Thu, 7 Aug 2025 15:11:44 -0700 Subject: [PATCH 3/4] test --- .github/workflows/test-pull-request.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index eee5da72..d46f02dd 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -42,8 +42,16 @@ jobs: # Full git history is needed to get a proper list of changed files # within `super-linter` fetch-depth: 0 - - name: Load Super Linter Environment - run: cat ".github/super-linter.env" >> "$GITHUB_ENV" + + - name: Run Super Linter + uses: github/super-linter@v5 + env: + VALIDATE_MARKDOWN: true + VALIDATE_YAML: true + VALIDATE_JSON: true + MARKDOWN_CONFIG_FILE: .markdownlint.json + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup Node v16 for Yarn v3 uses: actions/setup-node@v3 @@ -65,10 +73,6 @@ jobs: with: cmd: install - - name: Lint Markdown files - with: - cmd: lint:md - - name: Check internal links uses: borales/actions-yarn@v3 with: From e4439d2caeedd8a31b6668b8a0fa65fb9154161c Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Thu, 7 Aug 2025 15:16:20 -0700 Subject: [PATCH 4/4] update --- .github/workflows/test-pull-request.yml | 3 ++- .markdownlint.json | 13 +++++++------ package.json | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index d46f02dd..1bf26801 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -52,6 +52,7 @@ jobs: MARKDOWN_CONFIG_FILE: .markdownlint.json DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_ALL_CODEBASE: true - name: Setup Node v16 for Yarn v3 uses: actions/setup-node@v3 @@ -76,7 +77,7 @@ jobs: - name: Check internal links uses: borales/actions-yarn@v3 with: - cmd: test:links + cmd: checkLinks - name: Build site if: ${{ success() }} diff --git a/.markdownlint.json b/.markdownlint.json index d1601fcc..cd8badd8 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -1,9 +1,10 @@ { "default": false, - "MD025": { - "severity": "warning" - }, - "MD033": { - "severity": "error" - } + "MD009": true, + "MD012": true, + "MD013": false, + "MD041": true, + "MD025": true, + "MD024": true, + "MD026": true } diff --git a/package.json b/package.json index 33291f31..4577289e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "build": "gatsby build", "serve": "gatsby serve", "clean": "gatsby clean", - "lint:md": "markdownlint '**/*.md' --config .markdownlint.json", + "lint:md": "markdownlint-cli '**/*.md' --config .markdownlint.json", "buildNavigation": "npx --yes github:AdobeDocs/adp-devsite-utils buildNavigation -v", "buildRedirections": "npx --yes github:AdobeDocs/adp-devsite-utils buildRedirections -v", "renameFiles": "npx --yes github:AdobeDocs/adp-devsite-utils renameFiles -v",