-
Notifications
You must be signed in to change notification settings - Fork 199
126 lines (115 loc) · 4.37 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
mdlint_added_files:
type: string
required: false
mdlint_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
mdlint_added_files:
type: string
required: false
mdlint_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
# Components must be built before linting so that the custom properties are available
# in the dependencies for passthrough and token verification
- name: Build components & ui-icons
shell: bash
run: yarn build
- name: Lint component styles
if: ${{ inputs.styles_added_files != '' || inputs.styles_modified_files != '' }}
uses: reviewdog/[email protected]
with:
fail_level: error
filter_mode: diff_context
level: error
reporter: github-pr-review
# stylelint_input: "components/*/index.css components/*/themes/*.css"
stylelint_input: "${{ inputs.styles_added_files }} ${{ inputs.styles_modified_files }}"
stylelint_config: "${{ github.workspace }}/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_level: error
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 }}"
- name: Run markdownlint on documentation
uses: reviewdog/[email protected]
with:
reporter: github-pr-review
filter_mode: diff_context
fail_level: error
markdownlint_flags: "--config ${{ github.workspace }}/.markdownlint.json ${{ inputs.mdlint_added_files }} ${{ inputs.mdlint_modified_files }}"