diff --git a/.github/scripts/lib/github.ts b/.github/scripts/lib/github.ts index 3c21b36f7..a20f97247 100644 --- a/.github/scripts/lib/github.ts +++ b/.github/scripts/lib/github.ts @@ -71,6 +71,11 @@ export class GitHubAPI { throw new Error(`GitHub API error: ${response.status} ${response.statusText}`); } + // 204 No Content(DELETE 等)不解析 body + if (response.status === 204) { + return undefined as T; + } + return response.json() as Promise; } @@ -278,8 +283,7 @@ export function setMultilineOutput (name: string, value: string): void { // ============== 环境变量工具 ============== -export function getEnv (name: string, required: true): string; -export function getEnv (name: string, required?: false): string | undefined; +// Note: 不使用函数重载——Node.js --experimental-strip-types 不支持 TS overload signatures export function getEnv (name: string, required = false): string | undefined { const value = process.env[name]; if (required && !value) { diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 05677e141..caebddbdf 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -191,7 +191,7 @@ jobs: with: name: NapCat.Framework path: workspace/framework-dist - retention-days: 7 # 保留 7 天 + retention-days: 5 # 保留 5 天(仓库上限) # --------------------------------------------------------------------------- # Job 4: 构建 Shell 包 @@ -263,7 +263,7 @@ jobs: with: name: NapCat.Shell path: workspace/shell-dist - retention-days: 7 # 保留 7 天 + retention-days: 5 # 保留 5 天(仓库上限) # --------------------------------------------------------------------------- # Job 5: 更新评论为构建结果 @@ -370,7 +370,7 @@ jobs: with: name: install-script path: ./release-assets/install.sh - retention-days: 7 + retention-days: 5 if-no-files-found: ignore # ---------------------------------------------------------------------------