-
Notifications
You must be signed in to change notification settings - Fork 5.3k
110 lines (103 loc) · 3.51 KB
/
pull-request-checks.yaml
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
name: Pull Request Checks
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
on:
pull_request:
branches:
- master
jobs:
spellcheck:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
name: Checkout
- uses: jitterbit/get-changed-files@v1
id: changed_files
name: Get changed files
- id: md_changed_files
name: Spellcheck Markdown files
run: |-
files=''
for f in ${{ steps.changed_files.outputs.added_modified }}
do
ext="${f##*.}"
if [ $ext = "md" ] || [ $ext = "mdx" ]
then
files="${f} ${files}"
fi
done
echo "files=${files}" >> $GITHUB_ENV
- uses: rojopolis/[email protected]
name: Spellcheck
if: ${{ env.files }}
with:
source_files: ${{ env.files }}
task_name: Markdown
lint:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
# Full git history is needed to get a proper list of changed files
# within `super-linter`
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: 7.33.6
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install -r
- name: Setup Node Env
uses: actions/[email protected]
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
- name: Compile TypeScript
run: npm run build
- name: Lint Code Base
uses: github/super-linter@v6
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc
LINTER_RULES_PATH: /
VALIDATE_ALL_CODEBASE: false
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_JSON: true
# ESLint only on changed files (not the same as the above super-linter)
- name: Get Changed Files (space-separated)
id: changed_files_space
uses: jitterbit/get-changed-files@v1
with:
format: 'space-delimited'
- name: Lint changed files
run: npx eslint --quiet ${{ steps.changed_files_space.outputs.added_modified }} ${{ steps.changed_files_space.outputs.renamed }}
- name: Get Changed Files (comma-separated)
id: changed_files
uses: jitterbit/get-changed-files@v1
with:
format: 'csv'
# NOTE: These steps are kept in this workflow to avoid re-rerunning the rest of the lint job
# in the Components Checks workflow
- name: Check component keys
run: node scripts/findBadKeys.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }}
- name: Check component app prop
run: node scripts/checkComponentAppProp.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }}
- name: Check for duplicate component keys
run: node scripts/findDuplicateKeys.js