Skip to content

Commit

Permalink
only check part of changed github profiles (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Jul 25, 2021
1 parent e03267e commit 208717f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions jekyll/_contributors/atorber.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name: atorber
site: <https://github.com/atorber>
bio: 一个酷爱编码的产品经理
avatar: /assets/contributors/atorber/avatar.png
avatar: /assets/contributors/atorber/avatar.webp
email: [email protected]
---
---
2 changes: 1 addition & 1 deletion src/jekyll/get-frontmatter-avatar-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test('getFrontmatterAvatarList', async t => {
'huan.md',
)
const EXPECTED_AVATAR_NUM = 1
const EXPECTED_AVATAR_PATH = '/assets/contributors/huan/avatar.jpg'
const EXPECTED_AVATAR_PATH = '/assets/contributors/huan/avatar.webp'

const imageList = getFrontmatterAvatarList(FILE)

Expand Down
20 changes: 17 additions & 3 deletions tests/jekyll/contributor-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import util from 'util'
import fs from 'fs'
import globCB from 'glob'
import { loadFront } from 'yaml-front-matter'
import { chunk } from 'lodash'
import {
chunk,
shuffle,
} from 'lodash'

import {
JEKYLL_FOLDER,
Expand Down Expand Up @@ -104,14 +107,25 @@ test('developer profile name must be GitHub username', async t => {
since: '1 week ago',
})

const needToBeChecked = (file: string) => changedFileList.includes(file)

// console.info('changedFileList', changedFileList)
// console.info('allContributorsFileList', allContributorsFileList)

const urlList = allContributorsFileList
.filter(file => changedFileList.includes(file))
let urlList = allContributorsFileList
.filter(needToBeChecked)
.map(contributorFilenameToUsername)
.map(name => `https://github.com/${name}`)

/**
* Huan(202107): Only check part of them because of the limitation of GitHub API
*/
const MAX_NUM = 50
if (urlList.length > MAX_NUM) {
urlList = shuffle(urlList)
.slice(0, MAX_NUM)
}

// console.info(urlList)

const nameListChunk = chunk(urlList, 10)
Expand Down

0 comments on commit 208717f

Please sign in to comment.