This repository was archived by the owner on Jan 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
154 lines (149 loc) · 5.6 KB
/
action.yml
File metadata and controls
154 lines (149 loc) · 5.6 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: 'Repo Viewer Search Index'
description: '生成 Repo-Viewer 搜索所需的 RV-Index 分支索引与 manifest'
author: 'Repo Viewer Team'
branding:
icon: 'search'
color: 'blue'
inputs:
token:
description: '访问仓库并推送 RV-Index 分支所需的 PAT/GITHUB_TOKEN'
required: false
repository:
description: '目标仓库 (owner/name),默认使用 workflow 上下文'
required: false
repo-owner:
description: '目标仓库 owner,优先于 repository 输入'
required: false
repo-name:
description: '目标仓库名称,优先于 repository 输入'
required: false
default-branch:
description: 'manifest.repository.defaultBranch,默认为仓库默认分支'
required: false
repo-path:
description: '本地仓库路径,默认使用当前工作目录'
required: false
branches:
description: '需要生成索引的分支列表,逗号或换行分隔'
required: false
branch:
description: '单个分支名称,作为 branches 的补充'
required: false
index-branch:
description: '索引分支名称'
required: false
default: 'RV-Index'
worktree-path:
description: '索引分支在工作空间中的工作树路径'
required: false
temp-dir:
description: '预留参数,当前不再创建源分支 worktree'
required: false
short-sha-length:
description: '索引文件命名所使用的短提交哈希长度'
required: false
include-globs:
description: '生成索引时的 include glob 列表'
required: false
exclude-globs:
description: '生成索引时的 exclude glob 列表'
required: false
max-files-per-index:
description: '单个索引文件最多包含的条目数,设置 0 表示不分片'
required: false
default: '4000'
index-compression:
description: '索引文件压缩方式,可选 none 或 gzip'
required: false
default: 'gzip'
skip-empty-commit:
description: '当无文件变化时是否跳过提交'
required: false
default: 'true'
push:
description: '是否在索引更新后推送 RV-Index 分支'
required: false
default: 'true'
commit-message:
description: '索引更新的提交信息模板,支持 {updates} 占位符'
required: false
default: 'chore(search-index): update {updates}'
git-user-name:
description: '索引提交使用的 Git 用户名'
required: false
default: 'Repo Viewer Bot'
git-user-email:
description: '索引提交使用的 Git 邮箱'
required: false
default: 'repo-viewer-bot@users.noreply.github.com'
node-version:
description: '运行 CLI 所需的 Node.js 版本'
required: false
default: '24.12.0'
outputs:
manifest-path:
description: '生成的 manifest.json 的绝对路径'
value: ${{ steps.run.outputs.manifest-path }}
manifest-relative-path:
description: 'manifest.json 在 RV-Index 工作树内的相对路径'
value: ${{ steps.run.outputs.manifest-relative-path }}
index-branch:
description: '用于存储索引的分支名称'
value: ${{ steps.run.outputs.index-branch }}
updated-branches:
description: '本次更新发生变化的分支列表'
value: ${{ steps.run.outputs.updated-branches }}
skipped-branches:
description: '本次检测但未产生变化的分支列表'
value: ${{ steps.run.outputs.skipped-branches }}
changes-detected:
description: '是否检测到任何变更'
value: ${{ steps.run.outputs.changes-detected }}
commit-sha:
description: '索引分支最新提交的 SHA'
value: ${{ steps.run.outputs.commit-sha }}
pushed:
description: '是否推送了索引分支'
value: ${{ steps.run.outputs.pushed }}
index-branch-existed:
description: '执行前索引分支是否已存在'
value: ${{ steps.run.outputs.index-branch-existed }}
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
- name: Install Repo-Viewer-Search dependencies
run: npm ci --omit=dev
shell: bash
working-directory: ${{ github.action_path }}
- name: Generate search index
id: run
run: node ${{ github.action_path }}/dist/bin/github-action.js
shell: bash
working-directory: ${{ github.workspace }}
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_REPOSITORY: ${{ inputs.repository != '' && inputs.repository || github.repository }}
INPUT_REPO_OWNER: ${{ inputs.repo-owner }}
INPUT_REPO_NAME: ${{ inputs.repo-name }}
INPUT_DEFAULT_BRANCH: ${{ inputs.default-branch != '' && inputs.default-branch || github.event.repository.default_branch || 'main' }}
INPUT_REPO_PATH: ${{ inputs.repo-path }}
INPUT_BRANCHES: ${{ inputs.branches }}
INPUT_BRANCH: ${{ inputs.branch }}
INPUT_INDEX_BRANCH: ${{ inputs.index-branch }}
INPUT_WORKTREE_PATH: ${{ inputs.worktree-path }}
INPUT_TEMP_DIR: ${{ inputs.temp-dir }}
INPUT_SHORT_SHA_LENGTH: ${{ inputs.short-sha-length }}
INPUT_INCLUDE_GLOBS: ${{ inputs.include-globs }}
INPUT_EXCLUDE_GLOBS: ${{ inputs.exclude-globs }}
INPUT_MAX_FILES_PER_INDEX: ${{ inputs.max-files-per-index }}
INPUT_INDEX_COMPRESSION: ${{ inputs.index-compression }}
INPUT_SKIP_EMPTY_COMMIT: ${{ inputs.skip-empty-commit }}
INPUT_PUSH: ${{ inputs.push }}
INPUT_COMMIT_MESSAGE: ${{ inputs.commit-message }}
INPUT_GIT_USER_NAME: ${{ inputs.git-user-name }}
INPUT_GIT_USER_EMAIL: ${{ inputs.git-user-email }}
GITHUB_TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}