* 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)
| 929 | * concept of entry "status". Useful for things like deploy preview links. |
| 930 | */ |
| 931 | async getStatuses(collectionName: string, slug: string) { |
| 932 | const contentKey = this.generateContentKey(collectionName, slug); |
| 933 | const branch = branchFromContentKey(contentKey); |
| 934 | const pullRequest = await this.getBranchPullRequest(branch); |
| 935 | const sha = pullRequest.head.sha; |
| 936 | const resp: { statuses: GitHubCommitStatus[] } = await this.request( |
| 937 | `${this.originRepoURL}/commits/${sha}/status`, |
| 938 | ); |
| 939 | return resp.statuses.map(s => ({ |
| 940 | context: s.context, |
| 941 | target_url: s.target_url || '', |
| 942 | state: |
| 943 | s.state === GitHubCommitStatusState.Success ? PreviewState.Success : PreviewState.Other, |
| 944 | })); |
| 945 | } |
| 946 | |
| 947 | async persistFiles(dataFiles: DataFile[], mediaFiles: AssetProxy[], options: PersistOptions) { |
| 948 | const files = mediaFiles.concat(dataFiles); |
no test coverage detected