From f8716d6ea0d9d064e627101accf709a90c5e7b3b Mon Sep 17 00:00:00 2001 From: reggi Date: Thu, 5 Dec 2024 12:32:24 -0500 Subject: [PATCH] fix: allow build locally and prereleases --- cli/bin/build.js | 2 +- cli/lib/gh.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/bin/build.js b/cli/bin/build.js index d238c84afe1..b1dbaf99731 100644 --- a/cli/bin/build.js +++ b/cli/bin/build.js @@ -27,7 +27,7 @@ const checkContent = () => { build({ releases: require('../releases.json'), loglevel: process.argv.includes('--debug') || process.env.CI ? 'verbose' : 'info', - prerelease: false, + prerelease: true, useCurrent: checkOnly, contentPath, navPath, diff --git a/cli/lib/gh.js b/cli/lib/gh.js index 68ff583c538..8deb6562347 100644 --- a/cli/lib/gh.js +++ b/cli/lib/gh.js @@ -1,7 +1,13 @@ const {posix, sep} = require('node:path') +const {execSync} = require('node:child_process') if (!process.env.GITHUB_TOKEN) { - throw new Error('GITHUB_TOKEN env var is required to build CLI docs') + try { + // this allows people to run this locally + process.env.GITHUB_TOKEN = execSync('gh auth token', {encoding: 'utf8'}).trim() + } catch (err) { + throw new Error('GITHUB_TOKEN env var is required to build CLI docs') + } } let octokit