-
Notifications
You must be signed in to change notification settings - Fork 5
57 lines (47 loc) · 1.71 KB
/
pull-requests-test-and-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
name: Pull Request Test and Lint
on:
pull_request:
# synchronize commit(s) pushed to the pull request
types: [synchronize, opened]
jobs:
ensure_minimum_test_coverage_and_lint_all_files:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
# 0 indicates all history for all branches and tags
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: "https://npm.pkg.github.com"
- name: Cache Node files
uses: actions/cache@v3
id: cache
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Clean install (CI) dependencies if lockfile (above) changed
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests on changed since parent branch with coverage
run: npm run test -- --changedSince=origin/${{ github.base_ref }}
- name: Check linting on all files
run: npm run lint
# This is a temp fix until stylelint action fixes its issue
# https://github.com/reviewdog/reviewdog/issues/1158#issuecomment-1097649732
- name: Stylelint Owner Fix
run: sudo chown -R root:root $GITHUB_WORKSPACE
- name: stylelint
uses: reviewdog/action-stylelint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
reporter: github-pr-review
filter_mode: "diff_context"
stylelint_config: ".stylelintrc.json"
stylelint_input: "**/*.scss"