discourse-wechat/.github/workflows/plugin-linting.yml

58 lines
1.5 KiB
YAML
Raw Normal View History

2021-04-02 18:53:34 -04:00
name: Linting
on:
push:
branches:
- main
pull_request:
concurrency:
group: plugin-linting-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
2021-04-02 18:53:34 -04:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
2021-04-02 18:53:34 -04:00
- name: Set up Node.js
uses: actions/setup-node@v3
2021-04-02 18:53:34 -04:00
with:
node-version: 18
cache: yarn
- name: Yarn install
run: yarn install
2021-04-02 18:53:34 -04:00
- name: Set up ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: ESLint
if: ${{ !cancelled() }}
run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
2021-04-02 18:53:34 -04:00
- name: Prettier
if: ${{ !cancelled() }}
2021-04-07 10:41:13 -04:00
shell: bash
2021-04-02 18:53:34 -04:00
run: |
yarn prettier -v
if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
2021-04-07 10:41:13 -04:00
yarn prettier --list-different "assets/**/*.{scss,js,es6}"
2021-04-02 18:53:34 -04:00
fi
if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
2021-04-07 10:41:13 -04:00
yarn prettier --list-different "test/**/*.{js,es6}"
2021-04-02 18:53:34 -04:00
fi
- name: Ember template lint
if: ${{ !cancelled() }}
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts admin/assets/javascripts
2021-04-02 18:53:34 -04:00
- name: Rubocop
if: ${{ !cancelled() }}
2021-04-02 18:53:34 -04:00
run: bundle exec rubocop .