Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit ef586d3

Browse files
committed
feat: 完善 action
1 parent 596b3b6 commit ef586d3

62 files changed

Lines changed: 2596 additions & 14 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Repo Viewer Search Index
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
generate-index:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v5
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
- name: Generate Repo Viewer search index
22+
uses: H-Sofie/Repo-Viewer-Search@main
23+
with:
24+
branches: main, dev
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
name: CI
1+
name: Test
22

33
on:
44
push:
5+
paths-ignore:
6+
- '**.md'
7+
- 'docs/**'
58
branches:
69
- main
10+
- dev
711
- 'release/**'
812
- 'feature/**'
913
pull_request:
@@ -18,10 +22,10 @@ jobs:
1822
- name: Checkout repository
1923
uses: actions/checkout@v5
2024

21-
- name: Use Node.js 22
25+
- name: Use Node.js 24
2226
uses: actions/setup-node@v6
2327
with:
24-
node-version: 22
28+
node-version: 24
2529
cache: npm
2630
cache-dependency-path: package-lock.json
2731

@@ -41,8 +45,11 @@ jobs:
4145
run: npm run test:coverage
4246
shell: bash
4347

48+
- name: Build
49+
run: npm run build
50+
shell: bash
51+
4452
- name: Upload coverage report
45-
if: always()
4653
uses: actions/upload-artifact@v5
4754
with:
4855
name: coverage

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules/
2-
dist/
32
coverage/
43
reports/
54
.env

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Repo-Viewer-Search 为 [Repo-Viewer](https://github.com/UE-DND/Repo-Viewer) 项
1010

1111
## 环境要求
1212

13-
- Node.js ≥ 18.20(Actions 运行环境推荐 Node.js 22)
13+
- Node.js ≥ 18.20
1414
- Git ≥ 2.40(复合 Action 依赖 worktree 功能)
1515
- 可选:[`nektos/act`](https://nektosact.com/) 用于本地模拟 GitHub Actions
1616

@@ -31,7 +31,7 @@ npm run build # 生成 dist/ 与类型声明
3131

3232
## Node.js API
3333

34-
包导出在 `dist/` 目录提供 TypeScript 类型:
34+
包导出在 [`dist/`](./dist/) 目录提供 TypeScript 类型:
3535

3636
- `generateSearchIndex(options)`:扫描仓库,返回符合 [`docs/search-index-spec.md`](./docs/search-index-spec.md) 的索引文档。
3737
- `buildManifest(options, branchInputs)`:合并或更新 manifest。
@@ -71,17 +71,16 @@ jobs:
7171
permissions:
7272
contents: write
7373
steps:
74-
- uses: actions/checkout@v5
74+
- name: Checkout repository
75+
uses: actions/checkout@v5
7576
with:
7677
fetch-depth: 0
7778
persist-credentials: false
7879
- name: Generate Repo Viewer search index
7980
uses: H-Sofie/Repo-Viewer-Search@main
8081
with:
8182
token: ${{ secrets.RV_SEARCH_TOKEN }}
82-
branches: main,develop
83-
skip-empty-commit: true
84-
push: true
83+
branches: main, develop
8584
```
8685
8786
### Action 输入

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
- [x] 在工具栏或专用面板加入搜索入口,提供关键字、分支、文件类型筛选。
7171
- [x] 索引缺失时的空状态提示(引导配置 Actions)。
7272
- [x] 展示结果列表,支持点击跳转/预览。
73-
- [x] 提供“使用 GitHub API 搜索”回退按钮
73+
- [x] 当索引不可用时给出提示并阻止搜索操作
7474
5. [ ] 性能与缓存:
7575
- [ ] 实现索引数据本地缓存(`localStorage` 或内存)及失效策略。
7676
- [ ] 处理大索引的分页/惰性加载。

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ inputs:
7878
node-version:
7979
description: "运行 CLI 所需的 Node.js 版本"
8080
required: false
81-
default: "22"
81+
default: "24"
8282

8383
outputs:
8484
manifest-path:
@@ -124,7 +124,7 @@ runs:
124124

125125
- name: Generate search index
126126
id: run
127-
run: node ${{ github.action_path }}/dist/github-action.js
127+
run: node ${{ github.action_path }}/dist/bin/github-action.js
128128
shell: bash
129129
working-directory: ${{ github.workspace }}
130130
env:

dist/bin/cli.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
export {};
3+
//# sourceMappingURL=cli.d.ts.map

dist/bin/cli.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bin/cli.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bin/cli.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)