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