-
-
Notifications
You must be signed in to change notification settings - Fork 77
58 lines (51 loc) · 1.77 KB
/
pull_request_test.yml
File metadata and controls
58 lines (51 loc) · 1.77 KB
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
name: Pull Request Unit Test
on:
pull_request:
branches:
- development
jobs:
# CSS Enforcement
css-check:
name: Enforce CSS Modules
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for disallowed .css files in changed files
run: |
# Get list of changed CSS files in this PR
changed_files=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD | grep '\.css$' || true)
if [ -z "$changed_files" ]; then
echo "No CSS files changed in this PR"
exit 0
fi
echo "Changed CSS files:"
echo "$changed_files"
# Check if any of the changed files are disallowed
disallowed=$(echo "$changed_files" | grep -vE '(\.module\.css$|index\.css$)' || true)
if [ -n "$disallowed" ]; then
echo "❌ Disallowed CSS file detected! Only '.module.css' (or 'index.css') files are permitted."
echo "The following files violate the CSS Module policy:"
echo "$disallowed"
exit 1
else
echo "✅ CSS Module Enforcement Check passed - all changed CSS files are valid"
fi
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Unit Tests for Changed Files Only
run: yarn run test:changed
- name: Run Lint
run: yarn run lint