MCPcopy Create free account
hub / github.com/github/awesome-copilot / getDirectoryLastUpdated

Function getDirectoryLastUpdated

eng/generate-website-data.mjs:126–141  ·  view source on GitHub ↗

* Find the latest git-modified date for any file under a directory.

(gitDates, relativeDirPath)

Source from the content-addressed store, hash-verified

124 * Find the latest git-modified date for any file under a directory.
125 */
126function getDirectoryLastUpdated(gitDates, relativeDirPath) {
127 const prefix = `${relativeDirPath}/`;
128 let latestDate = null;
129 let latestTime = 0;
130
131 for (const [filePath, date] of gitDates.entries()) {
132 if (!filePath.startsWith(prefix)) continue;
133 const timestamp = Date.parse(date);
134 if (!Number.isNaN(timestamp) && timestamp > latestTime) {
135 latestTime = timestamp;
136 latestDate = date;
137 }
138 }
139
140 return latestDate;
141}
142
143/**
144 * Get the current commit SHA for the checked-out repository.

Callers 1

generateCanvasManifestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected