Skip to content

Optimize CI: Short-circuit Markdown lint when no .md files change #227

Description

@coderabbitai

Description

Currently, the Markdown lint step in the CI workflow runs unconditionally on every build, even when no Markdown files have changed in the PR or commit.

Proposed Enhancement

Add a paths-filter step to detect when Markdown files have changed and only run the Markdown lint step conditionally. This would improve CI efficiency by avoiding unnecessary linting operations.

Implementation Approach

  1. Add a paths-filter step using dorny/paths-filter@v2 before the Markdown lint step:

    - name: Check for Markdown changes
      id: changed
      uses: dorny/paths-filter@v2
      with:
        filters: |
          md:
            - '**/*.md'
  2. Update the Markdown lint step to include a conditional:

    - name: Markdown lint
      if: steps.changed.outputs.md == 'true'
      uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e
      # ... rest of configuration

Benefits

  • Faster CI builds when only non-Markdown files are changed
  • Reduced resource usage
  • More efficient workflow execution

References

Requested by: @leynos

Metadata

Metadata

Assignees

Labels

lowAin't annoying anyone but the QA department

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions