From 593e7e56b687600ed3e1a6b032b85960e92f60fb Mon Sep 17 00:00:00 2001 From: imfycc Date: Tue, 2 Nov 2021 05:39:36 +0800 Subject: [PATCH] feat: update FULLSYNC_LIMIT and PARTIALSYNC_LIMIT --- .github/workflows/full-sync.yml | 4 ++-- .github/workflows/partial-sync.yml | 4 ++-- libs/github.ts | 2 +- readme.zh.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/full-sync.yml b/.github/workflows/full-sync.yml index 2f5ac05..77ec1cf 100644 --- a/.github/workflows/full-sync.yml +++ b/.github/workflows/full-sync.yml @@ -24,7 +24,7 @@ jobs: NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }} NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} TOKEN_OF_GITHUB: ${{ secrets.TOKEN_OF_GITHUB }} - FULLSYNC_LIMIT: 20 - PARTIALSYNC_LIMIT: 10 + FULLSYNC_LIMIT: ${{ secrets.FULLSYNC_LIMIT }} + PARTIALSYNC_LIMIT: ${{ secrets.PARTIALSYNC_LIMIT }} FULL_SYNC: true run: npm start diff --git a/.github/workflows/partial-sync.yml b/.github/workflows/partial-sync.yml index c467294..006675c 100644 --- a/.github/workflows/partial-sync.yml +++ b/.github/workflows/partial-sync.yml @@ -33,8 +33,8 @@ jobs: NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }} NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} TOKEN_OF_GITHUB: ${{ secrets.TOKEN_OF_GITHUB }} - FULLSYNC_LIMIT: 2000 - PARTIALSYNC_LIMIT: 10 + FULLSYNC_LIMIT: ${{ secrets.FULLSYNC_LIMIT }} + PARTIALSYNC_LIMIT: ${{ secrets.PARTIALSYNC_LIMIT }} run: npm start - uses: actions/upload-artifact@v2 diff --git a/libs/github.ts b/libs/github.ts index ad45fc2..597ba3c 100644 --- a/libs/github.ts +++ b/libs/github.ts @@ -44,7 +44,7 @@ export class Github { const limit = +process.env.PARTIALSYNC_LIMIT || 10; console.log(`Github: Start to sync latest starred repos, limit is ${limit}`); - const data = await this.getLastStarredRepo(10); + const data = await this.getLastStarredRepo(limit); this.repoList.push( ...(data.starredRepositories.edges || []).map(({ node, starredAt }) => ({ ...node, diff --git a/readme.zh.md b/readme.zh.md index 8dd8e04..396b324 100644 --- a/readme.zh.md +++ b/readme.zh.md @@ -18,7 +18,7 @@ 除此之外,还可以修改环境变量的形式修改当前的配置,例如: - `FULLSYNC_LIMIT` 全量同步的最大 Repo 个数,默认为 2000 个 -- `PARTIALSYNC_LIMIT` 增量同步的最大 Repo 个数,每次增量同步会从后往前取若干条数据,默认为 20 个 +- `PARTIALSYNC_LIMIT` 增量同步的最大 Repo 个数,每次增量同步会从后往前取若干条数据,默认为 10 个 需要在 `github/workflows/*.yml` 中,修改这个配置