-
Notifications
You must be signed in to change notification settings - Fork 125
129 lines (108 loc) · 3.92 KB
/
frontend-lint.yml
File metadata and controls
129 lines (108 loc) · 3.92 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
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
127
128
name: Frontend Lint
# Trigger: PR to main/develop branches
on:
pull_request:
branches:
- main
- develop
paths:
- 'himarket-web/himarket-frontend/**'
- 'himarket-web/himarket-admin/**'
- '.github/workflows/frontend-lint.yml'
# Avoid duplicate runs: new commits to the same PR will cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Limit workflow permissions (security best practice)
permissions:
contents: read
pull-requests: read
jobs:
# Detect which parts of the codebase changed
changes:
name: Detect Changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
admin: ${{ steps.filter.outputs.admin }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
frontend:
- 'himarket-web/himarket-frontend/**'
admin:
- 'himarket-web/himarket-admin/**'
# Frontend Lint
himarket-frontend-lint:
name: Frontend - Lint & Type Check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.frontend == 'true'
defaults:
run:
working-directory: himarket-web/himarket-frontend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# cache: 'npm' # Disabled: no package-lock.json in repo
# cache-dependency-path: himarket-web/himarket-frontend/package-lock.json
- name: Install dependencies
run: npm install --legacy-peer-deps # Using legacy-peer-deps to handle React 19 compatibility
# - name: Run ESLint
# run: npm run lint
# # No continue-on-error - let it fail naturally
- name: Run TypeScript type check
run: npm run type-check
# No continue-on-error - let it fail naturally
- name: Create check summary
if: always()
run: |
echo "## 🔍 Frontend Lint & Type Check" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Checked ESLint rules and TypeScript types for frontend code." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note:** This check is optional and won't block PR merging." >> $GITHUB_STEP_SUMMARY
echo "However, it's recommended to fix any issues found." >> $GITHUB_STEP_SUMMARY
# Admin Lint
himarket-admin-lint:
name: Admin - Lint Check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.admin == 'true'
defaults:
run:
working-directory: himarket-web/himarket-admin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# cache: 'npm' # Disabled: no package-lock.json in repo
# cache-dependency-path: himarket-web/himarket-admin/package-lock.json
- name: Install dependencies
run: npm install --legacy-peer-deps # Using legacy-peer-deps to handle React 19 compatibility
# - name: Run ESLint
# run: npm run lint
# # No continue-on-error - let it fail naturally
- name: Create check summary
if: always()
run: |
echo "## 🔍 Admin Lint Check" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Checked ESLint rules for admin console code." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note:** This check is optional and won't block PR merging." >> $GITHUB_STEP_SUMMARY
echo "However, it's recommended to fix any issues found." >> $GITHUB_STEP_SUMMARY