-
Notifications
You must be signed in to change notification settings - Fork 197
100 lines (91 loc) · 3.3 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Lint
#
# This workflow lints the UI library and reports back any suggested fixes
#
on:
workflow_dispatch:
inputs:
styles_added_files:
type: string
required: false
styles_modified_files:
type: string
required: false
eslint_added_files:
type: string
required: false
eslint_modified_files:
type: string
required: false
workflow_call:
inputs:
styles_added_files:
type: string
required: false
styles_modified_files:
type: string
required: false
eslint_added_files:
type: string
required: false
eslint_modified_files:
type: string
required: false
permissions:
contents: read
pull-requests: write
jobs:
# --- Lint pre-compiled assets for consistency --- #
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# install but don't build - we're linting pre-compiled assets
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node LTS version
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Enable Corepack
run: corepack enable
## --- YARN CACHE --- ##
- name: Check for cached dependencies
continue-on-error: true
id: cache-dependencies
uses: actions/cache@v4
with:
path: |
.cache/yarn
node_modules
key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }}
## --- INSTALL --- ##
# If statement isn't needed here b/c yarn will leverage the cache if it exists
- name: Install dependencies
shell: bash
run: yarn install --immutable
- name: Lint component styles
if: ${{ inputs.styles_added_files != '' || inputs.styles_modified_files != '' }}
uses: reviewdog/[email protected]
with:
fail_on_error: true
level: error
reporter: github-pr-review
filter_mode: diff_context
# stylelint_input: "components/*/index.css components/*/themes/*.css"
stylelint_input: "${{ inputs.styles_added_files }} ${{ inputs.styles_modified_files }}"
stylelint_config: stylelint.config.js
- name: Run eslint on packages and stories
uses: reviewdog/[email protected]
if: ${{ inputs.eslint_added_files != '' || inputs.eslint_modified_files != '' }}
with:
fail_on_error: true
level: error
reporter: github-pr-review
filter_mode: diff_context
# eslint_flags: "components/*/stories/*.js"
eslint_flags: "${{ inputs.eslint_added_files }} ${{ inputs.eslint_modified_files }}"