Skip to content

GitHub Action linting markdown & its frontmatter content.

License

Notifications You must be signed in to change notification settings

timhagn/lint-md-fm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lint-md-fm

GitHub Action linting markdown & its frontmatter content.

Development

This repo has been created with yarn.

To be able to test the action also install act.

Further, to publish the action without node_modules coming in the way, install ncc.

To ease formatting, prettier is installed and may be called for testing with:

yarn format

and with

yarn format:fix

to automatically fix formatting.

Info

More info on creating JavaScript GitHub actions may be found on GitHub.


Markdown Frontmatter & project files linter

This action checks all added files of a push / PR to the solana-labs/ecosystem repo.

Inputs

Input Name Required Default Description
repoToken true - The GITHUB_TOKEN to be bale to post comments on the PR.
debug false false Show additional info.
changed-files true - Which files to lint, get from tj-actions/changed-files
directories false "projects", "img" Multiple directories to search in.
markdown-extensions true ".md", ".mdx" Multiple extensions of Markdown files to check for.
image-extensions false ".svg", ".png", ".jpg", ".jpeg" Multiple extensions of image files to check for.
fuzzy-search false true Should the existing projects be checked for duplicates with nearest neighbor (fuzzy) search.
force-check false false Check all files instead of only added ones.

Outputs

changed

Which files where changed.

Example usage

- name: Lint Current PR
  id: lint
  uses: timhagn/lint-md-fm@v1.0.12
  with:
    changed-files: ${{ steps.changed_files.outputs.all_modified_files }}
    directories: |
      projects
      img
    markdown-extensions: |
      md
      mdx
    image-extensions: |
      png
      svg
      jpg
      jpeg
    fuzzy-search: true

TODO

Adapt this action to one we can use to check the ecosystem projects for:

  • project files in a PR not correctly named {project-name}.md with .md ext
  • missing or misnamed logo files
  • logo files in the wrong format (not SVG / PNG / JPG)
  • (only for bonus-points: image sizes)
  • categories not in the CATEGORY_MAPPING
  • add strict / fuzzy matching for slug & title duplicate checking
  • cleaned up reporting / logging
  • adapt this README file to the functionality of the final action

Possible additions:

  • add force-check option to check all files
  • get CATEGORY_MAPPING from solana-com (API call)

Find gray-matter already installed to work with Markdown & Frontmatter.

About

GitHub Action linting markdown & its frontmatter content.

Resources

License

Stars

Watchers

Forks

Packages

No packages published