This Github workflow aims to automatically fix as many lint errors as possible.
In particular, it executes eslint with --fix
argument, so that we report and fix lint errors. Note that not all lint errors can be fixed automatically.
If any errors were fixed by eslint
, a new PR is created including the changes made. The base is always the current branch while the assignee is the PR author.
This allows the PR author to review the changes and if needed merge them into the initial PR.
On top of that, the PR is marked with the label autofix
.
My Workflow
The repository can be found here.
On purpose there is a lint error in index.js
and you can review the PR created here to fix this. .
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
softius / actions-auto-improve-code-style
Create a PR automatically to fix code linting errors.
actions-auto-improve-code-style
This GitHub workflow executes eslint with --fix
argument, so that we can not only capture but also automatically fix as many as possible.
If any errors were fixed by eslint
, a new PR is created including the changes made. The base is always the current branch while the assignee is the PR author.
This allows the PR author to review the changes and if needed merge them into into the initial PR.
Additional Resources / Info
While this workflow uses eslint, the same approach can be used with phpcs/phpcbf and other linters.
To customize the workflow further, you can refer to this action.
Make sure to follow me on dev.to, Medium or Twitter to read more about PHP, Docker and other dev topics.
Photo by Ken Suarez on Unsplash
Top comments (0)