* 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)
| 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); |
no test coverage detected