(key: string)
| 505 | } |
| 506 | |
| 507 | async retrieveMetadataOld(key: string): Promise<Metadata> { |
| 508 | console.log( |
| 509 | '%c Checking for MetaData files', |
| 510 | 'line-height: 30px;text-align: center;font-weight: bold', |
| 511 | ); |
| 512 | |
| 513 | const metadataRequestOptions = { |
| 514 | params: { ref: 'refs/meta/_decap_cms' }, |
| 515 | headers: { Accept: 'application/vnd.github.v3.raw' }, |
| 516 | }; |
| 517 | |
| 518 | function errorHandler(err: Error) { |
| 519 | if (err.message === 'Not Found') { |
| 520 | console.log( |
| 521 | '%c %s does not have metadata', |
| 522 | 'line-height: 30px;text-align: center;font-weight: bold', |
| 523 | key, |
| 524 | ); |
| 525 | } |
| 526 | throw err; |
| 527 | } |
| 528 | |
| 529 | if (!this.useOpenAuthoring) { |
| 530 | const result = await this.request( |
| 531 | `${this.repoURL}/contents/${key}.json`, |
| 532 | metadataRequestOptions, |
| 533 | ) |
| 534 | .then((response: string) => JSON.parse(response)) |
| 535 | .catch(errorHandler); |
| 536 | |
| 537 | return result; |
| 538 | } |
| 539 | |
| 540 | const [user, repo] = key.split('/'); |
| 541 | const result = this.request( |
| 542 | `/repos/${user}/${repo}/contents/${key}.json`, |
| 543 | metadataRequestOptions, |
| 544 | ) |
| 545 | .then((response: string) => JSON.parse(response)) |
| 546 | .catch(errorHandler); |
| 547 | return result; |
| 548 | } |
| 549 | |
| 550 | async getPullRequests( |
| 551 | head: string | undefined, |
no test coverage detected