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

Method getStatuses

packages/decap-cms-backend-github/src/API.ts:906–920  ·  view source on GitHub ↗

* Retrieve statuses for a given SHA. Unrelated to the editorial workflow * concept of entry "status". Useful for things like deploy preview links.

(collectionName: string, slug: string)

Source from the content-addressed store, hash-verified

904 * concept of entry "status". Useful for things like deploy preview links.
905 */
906 async getStatuses(collectionName: string, slug: string) {
907 const contentKey = this.generateContentKey(collectionName, slug);
908 const branch = branchFromContentKey(contentKey);
909 const pullRequest = await this.getBranchPullRequest(branch);
910 const sha = pullRequest.head.sha;
911 const resp: { statuses: GitHubCommitStatus[] } = await this.request(
912 `${this.originRepoURL}/commits/${sha}/status`,
913 );
914 return resp.statuses.map(s => ({
915 context: s.context,
916 target_url: s.target_url || '',
917 state:
918 s.state === GitHubCommitStatusState.Success ? PreviewState.Success : PreviewState.Other,
919 }));
920 }
921
922 async persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions) {
923 const files = mediaFiles.concat(dataFiles);

Callers 2

getDeployPreviewMethod · 0.45
API.spec.jsFile · 0.45

Calls 5

generateContentKeyMethod · 0.95
getBranchPullRequestMethod · 0.95
requestMethod · 0.95
branchFromContentKeyFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected