keptn-sandbox / new-keptn-docs-engine

GSoC 2022 Project: New Documentation Site Engine
https://keptn-experimental-docs-site.netlify.app/
Apache License 2.0
6 stars 2 forks source link

Add Prettier GitHub Action support to format docs #23

Closed iamrajiv closed 2 years ago

iamrajiv commented 2 years ago

Problem statement

Prettier is a very popular code formatter that uses very opinionated but sensible styles to format your code and prevent ongoing debates about code styles. So we wanted a GitHub action to automatically format your code using Prettier.

Describe the solution you'd like

The solution utilizes the git-auto-commit-action alongside whatever formatting script we have in your repository.

For example, our repository has the following script to format using Prettier:

"format": "prettier --write '**/*.{css,html,js,json,jsx,md,mdx,ts,tsx,yaml,yml}'",

To set up the GitHub action, all we need to do is install our dependencies (e.g. yarn install), run our format script (e.g. yarn format), and then commit any changes if necessary.

Additional context

By utilizing Prettier with GitHub Actions, we can ensure that our code is formatted consistently and without any issues. It also helps to reduce manual work when formatting code.