C3: the seat git's tags name each tag's commit, at the seat's form 2
tags answers items {tag, commit} read from the forge's own tag list, a tag
the forge names no commit for being an error, never a tag without one; tag
writes <directory>/vMAJOR.MINOR.PATCH, the form the Go toolchain's direct
fallback reads, go/v<version> among them.
Builds: design 47 H2 §796, §780; H-A-350 DMC-3; mesh-delivery D5 d2d3ebbf
This commit is contained in:
@@ -499,11 +499,17 @@ export class GiteaClient {
|
||||
}
|
||||
|
||||
/** One page of a repository's tags, newest first, by name: what the seat git's `tags` answers. */
|
||||
async tags(owner: string, repo: string, page: number, limit: number): Promise<string[]> {
|
||||
async tags(owner: string, repo: string, page: number, limit: number): Promise<{ tag: string; commit: string }[]> {
|
||||
if (!Number.isInteger(page) || page < 1) throw new Error(`${page} is not a page, from 1`);
|
||||
const list = await this.request<any[]>(`${repoPath(owner, repo)}/tags?page=${page}&limit=${limit}`);
|
||||
if (!Array.isArray(list)) throw new Error(`the forge answered no list of the tags of ${owner}/${repo}`);
|
||||
return list.map((t) => String(t?.name ?? "")).filter((n) => n !== "");
|
||||
// Each tag with the commit it names (design 47 H2 §796): a tag the forge names no commit for is no answer, never a
|
||||
// tag without its commit.
|
||||
return list.filter((t) => String(t?.name ?? "") !== "").map((t) => {
|
||||
const tag = String(t.name), commit = String(t?.commit?.sha ?? "");
|
||||
if (!/^[0-9a-f]{40}$/.test(commit)) throw new Error(`the forge named no commit for ${owner}/${repo}'s tag ${tag}`);
|
||||
return { tag, commit };
|
||||
});
|
||||
}
|
||||
|
||||
/** The commit a tag names, or null when the repository has no such tag (the forge's 404 only). */
|
||||
|
||||
Reference in New Issue
Block a user