ci: 添加构建结果评论中的下载链接和获取 artifacts 列表功能

This commit is contained in:
时瑾
2025-12-29 03:14:17 +08:00
parent e6dbc7b9ab
commit e0f88a54f6
3 changed files with 59 additions and 12 deletions

View File

@@ -24,7 +24,14 @@ export interface Repository {
};
}
// ============== GitHub API Client ==============
export interface Artifact {
id: number;
name: string;
size_in_bytes: number;
archive_download_url: string;
}
// ============== GitHub API Client ==========================
export class GitHubAPI {
private token: string;
@@ -76,6 +83,13 @@ export class GitHubAPI {
}
}
async getRunArtifacts (owner: string, repo: string, runId: string): Promise<Artifact[]> {
const data = await this.request<{ artifacts: Artifact[]; }>(
`/repos/${owner}/${repo}/actions/runs/${runId}/artifacts`
);
return data.artifacts;
}
async createComment (owner: string, repo: string, issueNumber: number, body: string): Promise<void> {
await this.request(`/repos/${owner}/${repo}/issues/${issueNumber}/comments`, {
method: 'POST',