MCPcopy
hub / github.com/refined-github/refined-github / getRepoAge

Function getRepoAge

source/features/repo-age.tsx:49–65  ·  view source on GitHub ↗
(
	commitSha: string,
	commitsCount: number,
)

Source from the content-addressed store, hash-verified

47}
48
49async function getRepoAge(
50 commitSha: string,
51 commitsCount: number,
52): Promise<[committedDate: string, lastCommitsPageUrl: string]> {
53 const {repository} = await api.v4(GetRepoAge, {
54 variables: {
55 cursor: `${commitSha} ${commitsCount - Math.min(6, commitsCount)}`,
56 },
57 });
58
59 const {committedDate} = repository.defaultBranchRef.target.history.nodes
60 // Filter out any invalid commit dates #3185
61 .findLast((commit: CommitTarget) => new Date(commit.committedDate).getFullYear() > 1970);
62
63 const lastCommitsPageUrl = buildLastCommitsPageUrl(commitSha, commitsCount);
64 return [committedDate, lastCommitsPageUrl];
65}
66
67const firstCommit = new CachedFunction('first-commit', {
68 async updater(): Promise<[committedDate: string, lastCommitsPageUrl: string]> {

Callers 1

updaterFunction · 0.85

Calls 1

buildLastCommitsPageUrlFunction · 0.85

Tested by

no test coverage detected