From 16f1f61e75a93096267e746a656eac5134bf2a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Sun, 2 Aug 2026 20:58:55 +0800 Subject: [PATCH 01/13] =?UTF-8?q?ci:=20=E6=96=B0=E5=A2=9E=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/dependabot.yml | 10 +++++++++- .gitignore | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cc9c3881e..33165cd9a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,4 +9,12 @@ updates: directory: "/" schedule: interval: "weekly" - open-pull-requests-limit: 3 + groups: + github-actions: + patterns: + - "*" + + - package-ecosystem: "npm" + directory: "/vscode-extension" + schedule: + interval: "weekly" diff --git a/.gitignore b/.gitignore index f717e0652..48c72717b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ Desktop.ini main(local).js # VS Code extension package *.vsix + +# logs +*.log From 32ffc7a472400a1c28cf39b87ee6e07a7138b609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Mon, 3 Aug 2026 20:48:58 +0800 Subject: [PATCH 02/13] =?UTF-8?q?ci:=20=E6=96=B0=E5=A2=9E=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=20VSCode=20=E6=8F=92=E4=BB=B6=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/build-vscode-extension.yml diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml new file mode 100644 index 000000000..c65003005 --- /dev/null +++ b/.github/workflows/build-vscode-extension.yml @@ -0,0 +1,70 @@ +name: Build & Release Extension + +on: + schedule: + - cron: '0 0 */5 * *' + push: + paths: + - 'vscode-extension/**' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + outputs: + expires_at: ${{ steps.calc-expiry.outputs.expires_at }} + artifact_name: ${{ steps.package.outputs.artifact_name }} + + steps: + - name: 检出代码 + uses: actions/checkout@v4 + + - name: 设置 Node.js 环境 + uses: actions/setup-node@v4 + with: + node-version: '24' + cache: 'npm' + + - name: 进入插件目录并安装依赖 + run: | + cd vscode-extension + npm install + + - name: 打包 VSIX + id: package + run: | + cd vscode-extension + npx @vscode/vsce package + VSIX_FILE=$(ls *.vsix | head -n 1) + echo "artifact_name=$VSIX_FILE" >> $GITHUB_OUTPUT + + - name: 计算过期时间 + id: calc-expiry + run: | + EXPIRY_DATE=$(date -u -d "+5 days" '+%Y-%m-%d %H:%M UTC') + echo "expires_at=$EXPIRY_DATE" >> $GITHUB_OUTPUT + + - name: 上传构件 + uses: actions/upload-artifact@v4 + with: + name: github-chinese-extension + path: vscode-extension/*.vsix + retention-days: 5 + + - name: 生成运行摘要 + if: always() + run: | + cat >> $GITHUB_STEP_SUMMARY << 'EOF' + ## 📦 GitHub 中文化扩展构建报告 + + | 项目 | 详情 | + | :--- | :--- | + | **构建状态** | ${{ job.status == 'success' && '✅ 成功' || '❌ 失败' }} | + | **产物名称** | `${{ steps.package.outputs.artifact_name }}` | + | **保留策略** | 5 天 | + | **⏰ 预计过期时间** | **${{ steps.calc-expiry.outputs.expires_at }}** | + + > [!WARNING] + > GitHub Actions 附件会在过期后**自动永久删除且不可恢复**。 + > 请务必在上述日期前下载 `.vsix` 文件。 + EOF \ No newline at end of file From 8de9a3e521c1a740973c23f05a61607faf80fb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:29:38 +0800 Subject: [PATCH 03/13] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=20vscode=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=9E=84=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 81 ++++++++++++++++++-- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index c65003005..8a9e812ee 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -1,11 +1,21 @@ name: Build & Release Extension on: + # 定时触发:每5天自动运行一次 schedule: - cron: '0 0 */5 * *' + + # 代码推送触发:当 vscode-extension 目录有变更时自动构建 push: paths: - 'vscode-extension/**' + + # PR 触发:当 PR 涉及 vscode-extension 目录变更时构建 + pull_request: + paths: + - 'vscode-extension/**' + + # 手动触发:允许在 Actions 页面手动点击运行 workflow_dispatch: jobs: @@ -14,6 +24,7 @@ jobs: outputs: expires_at: ${{ steps.calc-expiry.outputs.expires_at }} artifact_name: ${{ steps.package.outputs.artifact_name }} + vsix_path: ${{ steps.package.outputs.vsix_path }} steps: - name: 检出代码 @@ -37,6 +48,7 @@ jobs: npx @vscode/vsce package VSIX_FILE=$(ls *.vsix | head -n 1) echo "artifact_name=$VSIX_FILE" >> $GITHUB_OUTPUT + echo "vsix_path=vscode-extension/$VSIX_FILE" >> $GITHUB_OUTPUT - name: 计算过期时间 id: calc-expiry @@ -45,11 +57,68 @@ jobs: echo "expires_at=$EXPIRY_DATE" >> $GITHUB_OUTPUT - name: 上传构件 - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: github-chinese-extension path: vscode-extension/*.vsix retention-days: 5 + archive: false + + - name: 评论 PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const artifactName = '${{ steps.package.outputs.artifact_name }}'; + const expiresAt = '${{ steps.calc-expiry.outputs.expires_at }}'; + const runId = context.runId; + const repo = context.repo; + + const artifactUrl = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId}/artifacts`; + + const comment = ` + ## 📦 GitHub 中文化扩展构建完成 + + | 项目 | 详情 | + | :--- | :--- | + | **构建状态** | ✅ 成功 | + | **产物名称** | \`${artifactName}\` | + | **预计过期时间** | **${expiresAt}** | + | **下载链接** | [点击下载构件](${artifactUrl}) | + + > [!WARNING] + > Actions 工作流工件仅保存5天,到期将永久删除 + + --- + **工作流运行详情**:${process.env.GITHUB_SERVER_URL}/${repo.owner}/${repo.repo}/actions/runs/${runId} + `; + + const { data: comments } = await github.rest.issues.listComments({ + owner: repo.owner, + repo: repo.repo, + issue_number: context.issue.number, + }); + + const botComment = comments.find(comment => + comment.user.type === 'Bot' && + comment.body.includes('GitHub 中文化扩展构建完成') + ); + + if (botComment) { + await github.rest.issues.updateComment({ + owner: repo.owner, + repo: repo.repo, + comment_id: botComment.id, + body: comment + }); + } else { + await github.rest.issues.createComment({ + owner: repo.owner, + repo: repo.repo, + issue_number: context.issue.number, + body: comment + }); + } - name: 生成运行摘要 if: always() @@ -60,11 +129,7 @@ jobs: | 项目 | 详情 | | :--- | :--- | | **构建状态** | ${{ job.status == 'success' && '✅ 成功' || '❌ 失败' }} | + | **触发方式** | ${{ github.event_name }} | | **产物名称** | `${{ steps.package.outputs.artifact_name }}` | - | **保留策略** | 5 天 | - | **⏰ 预计过期时间** | **${{ steps.calc-expiry.outputs.expires_at }}** | - - > [!WARNING] - > GitHub Actions 附件会在过期后**自动永久删除且不可恢复**。 - > 请务必在上述日期前下载 `.vsix` 文件。 - EOF \ No newline at end of file + | **预计过期时间** | **${{ steps.calc-expiry.outputs.expires_at }}** | + EOF From b62932ec9343d36265d5f6e0ac920d4e380ab1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:38:41 +0800 Subject: [PATCH 04/13] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20VSCode=20?= =?UTF-8?q?=E6=89=A9=E5=B1=95=20readme=20=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- vscode-extension/README.md | 77 +++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/vscode-extension/README.md b/vscode-extension/README.md index 77e2d92da..bfff0bc6e 100644 --- a/vscode-extension/README.md +++ b/vscode-extension/README.md @@ -14,7 +14,7 @@ > 该依赖扩展的 GitHub 源码仓库已被作者删除(404),市场列表仍存在但扩展不再维护。功能在当前版本中正常可用,但未来可能因 VS Code 更新而失效。 > [!NOTE] -> 本扩展尚未上架 [VS Code 市场](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_find-and-install-an-extension),需通过[源码构建](#从本仓库源码构建)或下载 VSIX 安装。上架后从市场安装时会自动安装 Integrated Browser Extensions。 +> 本扩展尚未上架 [VS Code 市场](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_find-and-install-an-extension),需通过[源码构建](#方案二从源码构建)或下载 VSIX 安装。上架后从市场安装时会自动安装 Integrated Browser Extensions。 ### 添加启动参数 @@ -23,32 +23,81 @@ VS Code 必须带 `--enable-proposed-api boylett.integrated-browser-extensions`
带参数启动 VS Code 的方式 -- 打开[运行对话框](https://learn.microsoft.com/windows/advanced-settings/modern-run),录入: +- 打开[运行对话框](https://learn.microsoft.com/windows/advanced-settings/modern-run),输入: + ```cmd "%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe" --enable-proposed-api boylett.integrated-browser-extensions ``` + - 或修改[“开始”菜单](https://www.microsoft.com/zh-cn/windows/tips/start-menu)的 VS Code 快捷方式,在 `目标` 字段末尾追加 [COMMAND_LINE_ARGUMENTS](https://learn.microsoft.com/openspecs/windows_protocols/ms-shllink/17b69472-0f34-4bcf-b290-eccdb8de224b): + ```cmd --enable-proposed-api boylett.integrated-browser-extensions ``` + 然后从“开始”菜单启动
-## 从本仓库源码构建 +## 安装方式 + +### 方案一:从 GitHub Actions 下载(推荐) + +> 该方案需要登录 GitHub 账号,若你没有账号,请使用 [方案二](#方案二从源码构建) + +1. 打开本仓库的 [Actions](https://github.com/maboloshi/github-chinese/actions/workflows/build-vscode-extension) 页面 + +2. 选择最近一次成功运行的 workflow + +3. 滚动到页面底部,在 **Artifacts** 区域下载 `github-chinese-extension.vsix` + +4. 在 VS Code 中按 `Ctrl+Shift+P` 打开命令面板 + +5. 输入 `Extensions: Install from VSIX...` 并选择刚才下载的 `.vsix` 文件 + +6. 安装完成后,在 VS Code 集成浏览器中刷新 GitHub 页面即可生效 + +### 方案二:从源码构建 + +#### 环境要求 + +- [Git](https://git-scm.cn/install) (可选,用于克隆仓库,若不打算安装 Git ,请自行将仓库下载至本地) + +- [NodeJS](https://nodejs.org) + +#### 构建步骤 + +在 PowerShell 中执行以下代码: + +```shell +git clone https://github.com/maboloshi/github-chinese.git # 克隆仓库 + +# 若你的网络环境无法访问 Github 克隆仓库,请自行寻找加速器等解决 + +cd github-chinese/vscode-extension # 进入插件目录 + +npm install # 安装依赖 + +# 若你的网络环境缓慢,请使用这行命令: + +# npm install --registry=https://registry.npmmirror.com + +npx @vscode/vsce package # 打包插件 +``` + +构建完成后,按方案一的第 4-5 步安装生成的 `.vsix` 文件。 + +## 常见问题 + +### 为什么打开 GitHub 页面没有汉化? -1. [克隆仓库](https://docs.github.com/zh/repositories/creating-and-managing-repositories/cloning-a-repository) -1. [在 VS Code 中打开该文件夹](https://code.visualstudio.com/docs/editor/workspaces#_folder-projects) -1. [打开终端](https://code.visualstudio.com/docs/terminal/getting-started#_run-your-first-command-in-the-terminal),执行: - ```powershell - cd vscode-extension - npm install - npx @vscode/vsce package - ``` -1. [从 VSIX 安装](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_install-from-a-vsix) +请检查以下几点: -> [!TIP] -> 推荐从[发行版](https://github.com/maboloshi/github-chinese/releases)直接下载 `.vsix`(如有)。 +1. **确认已安装依赖扩展**:Integrated Browser Extensions 必须已安装并启用 +2. **确认启动参数正确**:VS Code 必须带 `--enable-proposed-api boylett.integrated-browser-extensions` 参数启动 +3. **确认扩展已启用**:在扩展面板中确认 `GitHub 中文化` 扩展已启用 +4. **刷新页面**:在 VS Code 的集成浏览器中按 `Ctrl+R` 或 `F5` 刷新页面 +5. **重启 VS Code**:尝试完全退出并重新启动 VS Code ## 调试 From 47f2c982852cad749d70f45d3666d093ed263bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:42:57 +0800 Subject: [PATCH 05/13] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8D=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E9=94=81=E6=96=87=E4=BB=B6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 8a9e812ee..7d3dc762b 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -35,6 +35,7 @@ jobs: with: node-version: '24' cache: 'npm' + cache-dependency-path: 'vscode-extension/package-lock.json' - name: 进入插件目录并安装依赖 run: | From c7262aeb946adfad5fc2ecee60cbbd50338888fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:44:28 +0800 Subject: [PATCH 06/13] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 7d3dc762b..865760939 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -1,4 +1,4 @@ -name: Build & Release Extension +name: Build Extension on: # 定时触发:每5天自动运行一次 From 8cbcba1ccbfbdb4b674c50b051e0324e31410814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:47:24 +0800 Subject: [PATCH 07/13] chore: bump version from 1.0.0 to 1.0.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- vscode-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode-extension/package.json b/vscode-extension/package.json index c81fb69ff..39be9b688 100644 --- a/vscode-extension/package.json +++ b/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "github-chinese", "displayName": "GitHub 中文化", "description": "一键安装 GitHub 中文化脚本到 VS Code 集成浏览器", - "version": "1.0.0", + "version": "1.0.1", "author": "PtJade-Ceramic", "publisher": "PtJade-Ceramic", "license": "GPL-3.0", From 99e12dd31ac175e1b1b2ee6691c9571f8ed9ba62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:58:18 +0800 Subject: [PATCH 08/13] =?UTF-8?q?ci:=20=E6=96=B0=E5=A2=9E=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 865760939..54d98c0f2 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -17,6 +17,10 @@ on: # 手动触发:允许在 Actions 页面手动点击运行 workflow_dispatch: + +permissions: + contents: read + pull-requests: write jobs: build: From bbcd27848a77e4aa4ded77b763d526befbfd0925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 13:59:45 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=B8=8A=E6=B8=B8?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=8F=90=E4=BA=A4=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * main.user.js Update to 1.9.4.4-2026-07-29 Signed-off-by: action-assistant[bot] <152410706+action-assistant[bot]@users.noreply.github.com> * refactor: 移除根目录 main(vscode).user.js, 统一由扩展维护 (#767) * test: fix issue 702 regression expectations (#725) --------- Signed-off-by: action-assistant[bot] <152410706+action-assistant[bot]@users.noreply.github.com> Co-authored-by: action-assistant[bot] <152410706+action-assistant[bot]@users.noreply.github.com> Co-authored-by: PtJade Ceramic <185668489+PtJade-Ceramic@users.noreply.github.com> Co-authored-by: saime428 <51110572+saime428@users.noreply.github.com> --- main(vscode).user.js | 38 ------------------------------ main.user.js | 4 ++-- test/issue-702-regression.test.cjs | 19 ++++++++------- 3 files changed, 12 insertions(+), 49 deletions(-) delete mode 100644 main(vscode).user.js diff --git a/main(vscode).user.js b/main(vscode).user.js deleted file mode 100644 index 1e3fe004e..000000000 --- a/main(vscode).user.js +++ /dev/null @@ -1,38 +0,0 @@ -// ==UserScript== -// @name GitHub 中文化插件 (VS Code) -// @namespace https://github.com/maboloshi/github-chinese -// @description 专为 VS Code 集成浏览器 + Integrated Browser Extensions 优化。 -// ⚠️ 注意:Integrated Browser Extensions 的 GitHub 源码仓库已被删除(404), -// 市场列表仍存在但不再维护。此脚本供已安装用户参考。 -// 📌 关注 https://github.com/maboloshi/github-chinese/issues/747#issuecomment-5046504139 获取最新进展。 -// @copyright 2021, 沙漠之子 (https://maboloshi.github.io/Blog) -// @icon https://github.githubassets.com/pinned-octocat.svg -// @version 1.0.0 -// @author 沙漠之子 -// @license GPL-3.0 -// @match https://github.com/* -// @match https://skills.github.com/* -// @match https://gist.github.com/* -// @match https://education.github.com/* -// @match https://www.githubstatus.com/* -// @run-at document-start -// @grant GM_addStyle -// @grant GM_xmlhttpRequest -// @grant GM_getValue -// @grant GM_setValue -// @grant GM_registerMenuCommand -// @grant GM_unregisterMenuCommand -// @grant GM_notification -// @connect fanyi.iflyrec.com -// @require https://mirror.nju.edu.cn/github-chinese/locals.js -// @require https://mirror.nju.edu.cn/github-chinese/main.user.js -// @supportURL https://github.com/maboloshi/github-chinese/issues/747#issuecomment-5046504139 -// ==/UserScript== - -// 此文件为 VS Code Integrated Browser Extensions 的轻量包装脚本。 -// 通过 @require 从南大镜像远程加载 locals.js(词库)和 main.user.js(主逻辑)。 -// 如果 raw.githubusercontent.com 不可达,可使用南大镜像源 [main(nju.edu).user.js]。 - -(function () { - 'use strict'; -})(); diff --git a/main.user.js b/main.user.js index 55d00e386..0d8ca0d00 100644 --- a/main.user.js +++ b/main.user.js @@ -4,7 +4,7 @@ // @description 中文化 GitHub 界面的部分菜单及内容。原作者为楼教主(http://www.52cik.com/)。 // @copyright 2021, 沙漠之子 (https://maboloshi.github.io/Blog) // @icon https://github.githubassets.com/pinned-octocat.svg -// @version 1.9.4.4-2026-07-26 +// @version 1.9.4.4-2026-07-29 // @author 沙漠之子 // @license GPL-3.0 // @match https://github.com/* @@ -12,7 +12,7 @@ // @match https://gist.github.com/* // @match https://education.github.com/* // @match https://www.githubstatus.com/* -// @require https://raw.githubusercontent.com/maboloshi/github-chinese/gh-pages/locals.js?v1.9.4.4-2026-07-26 +// @require https://raw.githubusercontent.com/maboloshi/github-chinese/gh-pages/locals.js?v1.9.4.4-2026-07-29 // @run-at document-start // @grant GM_addStyle // @grant GM_xmlhttpRequest diff --git a/test/issue-702-regression.test.cjs b/test/issue-702-regression.test.cjs index 0e906f972..18a723cc8 100644 --- a/test/issue-702-regression.test.cjs +++ b/test/issue-702-regression.test.cjs @@ -161,19 +161,19 @@ const expectedReactNavLabels = { "Repositories": "儲存庫", "Code": "程式碼", "Issues": "議題", - "Pull requests": "拉取請求", + "Pull requests": "合併請求", "Discussions": "討論", "Actions": "操作", "Projects": "專案", "Wiki": "Wiki", "Security": "安全", - "Security and quality": "安全和品質", - "Insights": "洞察", - "Settings": "設定", - "Packages": "軟體包", - "Releases": "發行版", + "Security and quality": "安全和質量", + "Insights": "分析", + "Settings": "設置", + "Packages": "軟件包", + "Releases": "發行版本", "Stars": "星號", - "Agents": "智能體", + "Agents": "AI 代理", "Models": "模型", "Set status": "狀態設置", "Profile": "個人資料", @@ -186,7 +186,7 @@ const expectedReactNavLabels = { "Sign out": "退出", "Free": "免費", "Type / to search": "輸入 / 搜尋", - "Search code, repositories, users, issues, pull requests...": "搜尋程式碼、儲存庫、使用者、議題、拉取請求...", + "Search code, repositories, users, issues, pull requests...": "搜尋程式碼、儲存庫、用戶、議題、合併請求...", "Search": "搜尋", "Clear": "清除", "Search syntax tips": "搜尋語法提示", @@ -256,7 +256,8 @@ function loadRuntimeFunction(fileName, functionName, document) { const filePath = path.join(__dirname, '..', fileName); const source = fs.readFileSync(filePath, 'utf8'); const start = source.indexOf(` function ${functionName}(`); - const end = source.indexOf('\n\n function ', start + 1); + const nextFunction = source.slice(start + 1).search(/\r?\n\r?\n function /); + const end = nextFunction === -1 ? -1 : start + 1 + nextFunction; assert.notEqual(start, -1, `${functionName} should exist in ${fileName}`); assert.notEqual(end, -1, `${functionName} should be followed by another runtime function`); From 412b08c88f0c46f071c1e35f855f5995f1b71875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:21:24 +0800 Subject: [PATCH 10/13] =?UTF-8?q?ci:=20=E5=BA=94=E7=94=A8=20AI=20Agent=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 npm install 改为 npm ci Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 54d98c0f2..de722ae02 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -44,7 +44,7 @@ jobs: - name: 进入插件目录并安装依赖 run: | cd vscode-extension - npm install + npm ci - name: 打包 VSIX id: package From e23ed9faa58dc50ebfc83d527f03c38bda8ebcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:25:45 +0800 Subject: [PATCH 11/13] =?UTF-8?q?ci:=20=E5=BA=94=E7=94=A8=20AI=20Agent=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 替换打包方式部分过程 Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index de722ae02..30f6b2292 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -50,8 +50,14 @@ jobs: id: package run: | cd vscode-extension - npx @vscode/vsce package - VSIX_FILE=$(ls *.vsix | head -n 1) + # 清理旧的 VSIX 文件,避免上传历史构件 + rm -f ./*.vsix + # 使用 package.json 中的 name 和 version 生成确定性的文件名 + PKG_NAME=$(node -p "require('./package.json').name") + PKG_VERSION=$(node -p "require('./package.json').version") + VSIX_FILE="${PKG_NAME}-${PKG_VERSION}.vsix" + # 以指定的文件名打包 VSIX,避免依赖 ls 和通配符 + npx @vscode/vsce package -o "$VSIX_FILE" echo "artifact_name=$VSIX_FILE" >> $GITHUB_OUTPUT echo "vsix_path=vscode-extension/$VSIX_FILE" >> $GITHUB_OUTPUT From 28f9cb7adf66e64d2f3402be6e9b62520428b5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:26:50 +0800 Subject: [PATCH 12/13] =?UTF-8?q?ci:=20=E5=BA=94=E7=94=A8=20AI=20Agent=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更换上传文件的匹配方式 Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- .github/workflows/build-vscode-extension.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 30f6b2292..23b80dc42 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -71,7 +71,7 @@ jobs: uses: actions/upload-artifact@v7 with: name: github-chinese-extension - path: vscode-extension/*.vsix + path: ${{ steps.package.outputs.vsix_path }} retention-days: 5 archive: false From 7b16de1b28adb66d9283854e8f17deaccbabd0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B9=E5=8F=B7=E5=A4=A7=E5=B8=9D?= <162813557+th-dd@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:27:19 +0800 Subject: [PATCH 13/13] =?UTF-8?q?ci:=20=E5=BA=94=E7=94=A8=20AI=20Agent=20?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改错误的拼写 Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Signed-off-by: 叹号大帝 <162813557+th-dd@users.noreply.github.com> --- vscode-extension/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode-extension/README.md b/vscode-extension/README.md index bfff0bc6e..30db5d4e9 100644 --- a/vscode-extension/README.md +++ b/vscode-extension/README.md @@ -72,7 +72,7 @@ VS Code 必须带 `--enable-proposed-api boylett.integrated-browser-extensions` ```shell git clone https://github.com/maboloshi/github-chinese.git # 克隆仓库 -# 若你的网络环境无法访问 Github 克隆仓库,请自行寻找加速器等解决 +# 若你的网络环境无法访问 GitHub 克隆仓库,请自行寻找加速器等解决 cd github-chinese/vscode-extension # 进入插件目录