Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 5f66f3d

Browse files
committed
fix(sync-repo): edge case when sync github readme
1 parent a57034e commit 5f66f3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

utils/github_api/repo_search.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import R from 'ramda'
22
import { timeout } from 'promise-timeout'
33

4+
import { ISSUE_ADDR } from 'config'
5+
46
import { TIMEOUT_SEC, restEndpoint } from './config'
57
import { graphqlClient, restpClient } from './client'
68

@@ -63,6 +65,10 @@ export const transformRepo = res => {
6365
primaryLanguage,
6466
} = baseInfoRes
6567

68+
const readme = object
69+
? object.text
70+
: `同步错误: 目前只同步源仓库中的 README.md 文件,如果源仓库中为 README.MD / readme.md / readme.MD 等格式可能会导致该错误。 如果是其他原因,[恳请提交 issue](${ISSUE_ADDR}/new)`
71+
6672
return {
6773
title: name,
6874
ownerName: owner.login,
@@ -71,15 +77,15 @@ export const transformRepo = res => {
7177

7278
desc: description,
7379
homepageUrl,
74-
readme: object.text,
80+
readme,
7581

7682
issuesCount: issues.totalCount,
7783
prsCount: pullRequests.totalCount,
7884
starCount: stargazers.totalCount,
7985
forkCount,
8086
watchCount: watchers.totalCount,
8187

82-
primaryLanguage,
88+
primaryLanguage: primaryLanguage || { name: 'html', color: '#EB4B31' },
8389
license: getLicense(licenseInfo),
8490
releaseTag: getRelaseTag(releases),
8591
contributors,

0 commit comments

Comments
 (0)