How to Exclude Markdown Files from Super-Linter in GitHub Actions

How to Exclude Markdown Files from Super-Linter in GitHub Actions

The Issue:

I encountered a challenge while trying to exclude .md (Markdown) files from being processed by Super-Linter in my GitHub Actions pipeline. Despite multiple attempts using exclusions and ignore configurations, the linter continued to pick up Markdown files.

The Solution:

After reviewing the documentation and community suggestions, I found that Super-Linter provides two effective ways to exclude Markdown files:

  1. Using Environment Variables
    • Super-Linter supports environment variables for filtering files to include or exclude during the linting process:
      • FILTER_REGEX_INCLUDE: Specifies files to include.
      • FILTER_REGEX_EXCLUDE: Specifies files to exclude.
  2. Disabling Markdown Validation
    • Super-Linter provides Boolean environment variables to enable or disable specific language validations.
    • For Markdown, you can set:yamlCopy codeVALIDATE_MARKDOWN: false

Updated Workflow Example:

Below is the updated workflow configuration that successfully excludes Markdown files:

jobs:  
  build:  
    name: Lint Code Base  
    runs-on: ubuntu-latest  
    steps:  
      - name: Checkout Code  
        uses: actions/checkout@v3  
        with:  
          # Full git history is needed to get a proper list of changed files within `super-linter`  
          fetch-depth: 0  

      - name: Lint Code Base  
        uses: github/super-linter@v4  
        env:  
          VALIDATE_ALL_CODEBASE: false  
          DEFAULT_BRANCH: main  
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  
          VALIDATE_MARKDOWN: false  

Key Insights:

  • Avoid using unlisted inputs like with: exclusions or with: files, as these are not documented in Super-Linter’s v4.10.1 documentation.
  • Explicitly disabling Markdown validation via VALIDATE_MARKDOWN: false ensures .md files are skipped.
Scroll to Top