MCPcopy Create free account
hub / github.com/decaporg/decap-cms / readFileMetadata

Method readFileMetadata

packages/decap-cms-backend-github/src/API.ts:690–708  ·  view source on GitHub ↗
(path: string, sha: string | null | undefined)

Source from the content-addressed store, hash-verified

688 }
689
690 async readFileMetadata(path: string, sha: string | null | undefined) {
691 const fetchFileMetadata = async () => {
692 try {
693 const result: Endpoints['GET /repos/{owner}/{repo}/commits']['response']['data'] =
694 await this.request(`${this.originRepoURL}/commits`, {
695 params: { path, sha: this.branch },
696 });
697 const { commit } = result[0];
698 return {
699 author: commit.author?.name || commit.author?.email || '',
700 updatedOn: commit.author?.date || '',
701 };
702 } catch (e) {
703 return { author: '', updatedOn: '' };
704 }
705 };
706 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
707 return fileMetadata;
708 }
709
710 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
711 const result: Endpoints['GET /repos/{owner}/{repo}/git/blobs/{file_sha}']['response']['data'] =

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected