Created
November 19, 2021 03:21
-
-
Save skullface/6ce55840db8610a907a53eaa3c9ee22d to your computer and use it in GitHub Desktop.
Teensy GitHub Action to autofix linting errors (from the script defined in your package.json) per https://mskelton.medium.com/auto-formatting-code-using-prettier-and-github-actions-ed458f58b7df
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and autofix | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "16.x" | |
- run: | | |
npm ci | |
npm run lint -- --fix | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 🤖 linting with autofix | |
branch: ${{ github.head_ref }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use:
.github/workflows
directory