diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85a85de3fb..43b0c26cba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,6 +159,8 @@ jobs: mkdir -p ./dist/docs rm -rdf ./dist/docs/* cp -r ./docs/.vuepress/dist/* ./dist/docs + env: + GITHUB_TOKEN: ${{ github.token }} - name: '[ℹ️] git diff' id: git_diff diff --git a/docs/.vuepress/package.json b/docs/.vuepress/package.json index 0cf4ee9100..7f8594122f 100644 --- a/docs/.vuepress/package.json +++ b/docs/.vuepress/package.json @@ -1,6 +1,7 @@ { "license": "CC-BY-NC-SA-4.0", "dependencies": { + "@octokit/auth-action": "2.0.2", "@primer/octicons": "17.7.0", "@vuepress/client": "2.0.0-beta.51", "@vuepress/plugin-pwa": "2.0.0-beta.51", diff --git a/docs/.vuepress/utils/childProcess.ts b/docs/.vuepress/utils/childProcess.ts index a354faae38..0fbcbb1a4b 100644 --- a/docs/.vuepress/utils/childProcess.ts +++ b/docs/.vuepress/utils/childProcess.ts @@ -12,10 +12,13 @@ type Util = export default (utilsPath: string) => ({ run(file: Util, ...args: string[]) { - const result = execFileSync('./node_modules/.bin/ts-node', [ - path.join(utilsPath, `${file}.ts`), - ...args, - ]).toString(); + const result = execFileSync( + './node_modules/.bin/ts-node', + [path.join(utilsPath, `${file}.ts`), ...args], + { + env: process.env, + } + ).toString(); if (result) console.log(result); }, }); diff --git a/docs/.vuepress/utils/generate/projectStats.ts b/docs/.vuepress/utils/generate/projectStats.ts index 2df33a7210..5fcec4a5e3 100644 --- a/docs/.vuepress/utils/generate/projectStats.ts +++ b/docs/.vuepress/utils/generate/projectStats.ts @@ -1,6 +1,7 @@ import { execSync } from 'child_process'; import fs from 'fs'; +import { createActionAuth } from '@octokit/auth-action'; import { Octokit } from 'octokit'; import Showdown from 'showdown'; @@ -151,7 +152,9 @@ ${Object.entries(absoluteClocStats) fs.writeFileSync(clocStatsPath, fullClocResult); (async () => { - const octokit = new Octokit(); + const octokit = new Octokit({ + authStrategy: process.env.GITHUB_ACTION ? createActionAuth : undefined, + }); const firstCommit = ( await octokit.rest.repos.listCommits({ diff --git a/yarn.lock b/yarn.lock index 8f04e77a20..91ec8b3c80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,7 @@ __metadata: version: 0.0.0-use.local resolution: ".vuepress-548500@workspace:docs/.vuepress" dependencies: + "@octokit/auth-action": 2.0.2 "@primer/octicons": 17.7.0 "@vuepress/client": 2.0.0-beta.51 "@vuepress/plugin-pwa": 2.0.0-beta.51 @@ -1792,6 +1793,16 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-action@npm:2.0.2": + version: 2.0.2 + resolution: "@octokit/auth-action@npm:2.0.2" + dependencies: + "@octokit/auth-token": ^3.0.0 + "@octokit/types": ^8.0.0 + checksum: 033b8776964bfe68ff1f603c56a4e14cfe2d6d13599b025323e1d354d97f8f0a7b0b65b1c19dcb6658261932164dd3b73aaaa46d598f0ad04b054efedc221819 + languageName: node + linkType: hard + "@octokit/auth-app@npm:^4.0.0": version: 4.0.7 resolution: "@octokit/auth-app@npm:4.0.7"