chore: add CI and pre-commit hooks for linting #1
Workflow file for this run
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 | |
on: [pull_request] | |
permissions: | |
contents: read | |
jobs: | |
pr-title: | |
runs-on: ubuntu-latest | |
name: Check PR title format | |
permissions: | |
contents: read | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check PR title | |
uses: amannn/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
editorconfig: | |
runs-on: ubuntu-latest | |
name: Check editorconfig | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pip install editorconfig-checker=="2.7.3" | |
- run: ec | |
typos: | |
runs-on: ubuntu-latest | |
name: Check spelling | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: crate-ci/[email protected] | |
license-headers: | |
runs-on: ubuntu-latest | |
name: Check license headers | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo install [email protected] | |
- run: licensesnip check | |
check-all: | |
name: Check if all lint jobs succeeded | |
if: always() | |
needs: | |
- pr-title | |
- editorconfig | |
- typos | |
- license-headers | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether all needed jobs succeeded | |
uses: re-actors/[email protected] | |
with: | |
jobs: ${{ toJSON(needs) }} | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Prettify code | |
uses: creyD/[email protected] | |
with: | |
prettier_options: '--write **/*.{js,ts,tsx,css,html}' | |
black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: psf/black@stable |