Retrospring/.github/workflows/lint.yml

113 lines
3.5 KiB
YAML
Raw Normal View History

name: Lint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
2023-02-22 12:17:35 -08:00
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
2023-02-22 12:17:35 -08:00
with:
files: "**/*.rb"
- name: Install dependencies
run: sudo apt update && sudo apt-get install -y libpq-dev libxml2-dev libxslt1-dev libmagickwand-dev imagemagick libidn11-dev
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- name: Run rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile
reporter: github-pr-check
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
2023-02-22 12:17:35 -08:00
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
2023-02-22 12:17:35 -08:00
with:
files: "**/*.ts"
2023-10-15 04:13:52 -07:00
- name: Set up Node 16
uses: actions/setup-node@v3
with:
2023-10-15 04:13:52 -07:00
node-version: '16'
cache: 'yarn'
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- name: Install node modules
run: |
npm i -g yarn
yarn install --frozen-lockfile
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- uses: reviewdog/action-eslint@v1
with:
reporter: github-check
eslint_flags: '--ext .ts app/javascript'
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
haml-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
2023-02-22 12:17:35 -08:00
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
2023-02-22 12:17:35 -08:00
with:
files: "**/*.haml"
- name: Install dependencies
run: sudo apt update && sudo apt-get install -y libpq-dev libxml2-dev libxslt1-dev libmagickwand-dev imagemagick libidn11-dev
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
- uses: patch-technology/action-haml-lint@0.5
with:
reporter: github-check
rubocop_version: gemfile
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
2023-01-18 13:10:39 -08:00
stylelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.0
2023-02-22 12:17:35 -08:00
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
2023-02-22 12:17:35 -08:00
with:
files: "**/*.scss"
2023-10-15 04:13:52 -07:00
- name: Set up Node 16
2023-01-18 13:10:39 -08:00
uses: actions/setup-node@v3
with:
2023-10-15 04:13:52 -07:00
node-version: '16'
cache: 'yarn'
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
2023-01-18 13:10:39 -08:00
- name: Install node modules
run: |
npm i -g yarn
yarn install --frozen-lockfile
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'
2023-01-18 13:10:39 -08:00
- name: stylelint
uses: reviewdog/action-stylelint@v1.18.1
2023-01-18 13:10:39 -08:00
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
stylelint_input: 'app/assets/stylesheets/**/*.scss'
2023-02-22 12:17:35 -08:00
if: steps.changed-files.outputs.any_changed == 'true'