Skip to content

Commit 72c516c

Browse files
author
v_guanglwen
committed
feat: 测试
1 parent 424ff50 commit 72c516c

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

.github/workflows/pr-lint-check.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
name: PR Lint Check
1+
name: ESLint Check Changed Files
22

33
on:
4-
push:
5-
branches:
6-
- feat-pr-lint
7-
8-
concurrency:
9-
group: style-${{ github.head_ref || github.run_id }}
10-
cancel-in-progress: true
4+
push: # 每次推送代码时触发
5+
branches: [ feat-pr-lint ] # 针对这些分支的推送触发
116

127
jobs:
13-
lint:
8+
eslint-changed:
149
runs-on: ubuntu-latest
1510
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v4
18-
19-
- name: Check changed files
20-
id: changed-files
21-
uses: tj-actions/changed-files@v44
11+
- uses: actions/checkout@v4
2212
with:
23-
files: |
24-
miniprogram/**/*
13+
fetch-depth: 0 # 获取完整提交历史,用于比较变更
2514

26-
- name: Setup NodeJS
15+
- name: Setup Node.js
2716
uses: actions/setup-node@v4
28-
if: steps.changed-files.outputs.any_changed == 'true'
2917
with:
30-
node-version: 20
18+
node-version: '20' # 使用 Node.js 20
3119

32-
- name: Web dependencies
33-
if: steps.changed-files.outputs.any_changed == 'true'
20+
- name: Install dependencies
3421
run: npm install
3522

36-
- name: Web style check
37-
if: steps.changed-files.outputs.any_changed == 'true'
38-
run: npm run lint
23+
- name: Get changed files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v44
26+
with:
27+
since_last_remote_commit: 'true' # 只检查上次推送后的变更
28+
29+
- name: Filter JavaScript files
30+
id: filter-js
31+
run: |
32+
# 只筛选出.js/.ts/.jsx/.tsx文件
33+
changed_js_files=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | grep -E '\.(js|ts|jsx|tsx)$' || true)
34+
echo "changed_js_files=${changed_js_files}" >> $GITHUB_OUTPUT
35+
36+
- name: Run ESLint on changed JS files
37+
if: ${{ steps.filter-js.outputs.changed_js_files != '' }}
38+
run: |
39+
echo "Changed JS files: ${{ steps.filter-js.outputs.changed_js_files }}"
40+
npx eslint ${{ steps.filter-js.outputs.changed_js_files }}

miniprogram/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const config = require('./config')
33
const themeListeners = []
44
global.isDemo = true
55
App({
6-
console.log('App Launch11');
6+
console.log('App Launch');
77

88
onLaunch(opts, data) {
99
const that = this
@@ -21,7 +21,7 @@ console.log('App Launch11');
2121
console.log('读取预拉取数据成功', res)
2222
},
2323
fail() {
24-
console.log('读取预拉取数据失败')
24+
console.log('读取预拉取数据失败')
2525
wx.showToast({
2626
title: '无缓存数据',
2727
icon: 'none'

0 commit comments

Comments
 (0)