From 414d215f04e0d3563464c61e92a6a451416747c1 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Mon, 26 Jan 2026 22:16:08 +0800 Subject: [PATCH 1/2] Update ai plugin --- plugins/ai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ai b/plugins/ai index 67a7c31..d5b0e6e 160000 --- a/plugins/ai +++ b/plugins/ai @@ -1 +1 @@ -Subproject commit 67a7c31120217f43e5cf456f71d9790e32429488 +Subproject commit d5b0e6ed9e7d6516ef6df404f216c38062126ffd From c6a8ae140113f4d2a740538100fb2db25da0da46 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Mon, 26 Jan 2026 22:22:05 +0800 Subject: [PATCH 2/2] feat: allows validation of specified plugins --- .github/workflows/validate-plugin-toml.yml | 14 +++++++++++++- validate.ts | 19 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate-plugin-toml.yml b/.github/workflows/validate-plugin-toml.yml index b5d53f4..b9c6d53 100644 --- a/.github/workflows/validate-plugin-toml.yml +++ b/.github/workflows/validate-plugin-toml.yml @@ -16,19 +16,31 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 + + - name: Get changed plugins + id: changed + run: | + CHANGED_PLUGINS=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^plugins/' | cut -d'/' -f2 | sort -u | tr '\n' ' ') + echo "plugins=$CHANGED_PLUGINS" >> $GITHUB_OUTPUT + echo "Changed plugins: $CHANGED_PLUGINS" - name: Setup Node.js + if: steps.changed.outputs.plugins != '' uses: actions/setup-node@v4 with: node-version: '22' - name: Setup pnpm + if: steps.changed.outputs.plugins != '' uses: pnpm/action-setup@v4 with: version: 10 - name: Install dependencies + if: steps.changed.outputs.plugins != '' run: pnpm install - name: Validate plugin.toml files - run: pnpm validate + if: steps.changed.outputs.plugins != '' + run: pnpm validate ${{ steps.changed.outputs.plugins }} diff --git a/validate.ts b/validate.ts index 6cb5200..affeec8 100644 --- a/validate.ts +++ b/validate.ts @@ -99,9 +99,22 @@ function main() { process.exit(0) } - const pluginDirs = fs.readdirSync(pluginsDir, { withFileTypes: true }) - .filter(entry => entry.isDirectory() && !entry.name.startsWith('.')) - .map(entry => entry.name) + // 支持命令行参数指定要验证的插件 + const args = process.argv.slice(2) + let pluginDirs: string[] + + if (args.length > 0) { + // 验证指定的插件 + pluginDirs = args.filter(name => { + const pluginPath = path.join(pluginsDir, name) + return fs.existsSync(pluginPath) + }) + } else { + // 验证所有插件 + pluginDirs = fs.readdirSync(pluginsDir, { withFileTypes: true }) + .filter(entry => entry.isDirectory() && !entry.name.startsWith('.')) + .map(entry => entry.name) + } console.log(`验证 ${pluginDirs.length} 个插件...\n`)