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

Method getStatuses

packages/decap-cms-backend-github/src/API.ts:944–958  ·  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

942 * concept of entry "status". Useful for things like deploy preview links.
943 */
944 async getStatuses(collectionName: string, slug: string) {
945 const contentKey = this.generateContentKey(collectionName, slug);
946 const branch = branchFromContentKey(contentKey);
947 const pullRequest = await this.getBranchPullRequest(branch);
948 const sha = pullRequest.head.sha;
949 const resp: { statuses: GitHubCommitStatus[] } = await this.request(
950 `${this.originRepoURL}/commits/${sha}/status`,
951 );
952 return resp.statuses.map(s => ({
953 context: s.context,
954 target_url: s.target_url || '',
955 state:
956 s.state === GitHubCommitStatusState.Success ? PreviewState.Success : PreviewState.Other,
957 }));
958 }
959
960 async persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions) {
961 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