diff --git a/.github/workflows/add-push-artifacts.yml b/.github/workflows/add-push-artifacts.yml index 9ecf45af04120e..f439cabd44a04f 100644 --- a/.github/workflows/add-push-artifacts.yml +++ b/.github/workflows/add-push-artifacts.yml @@ -16,7 +16,7 @@ jobs: node-version: 14.x - run: npm install - run: node ./scripts/enumerate-features.js features.json - - run: node ./scripts/diff-features.js --format=json > features.diff.json + - run: node ./scripts/diff-features.js --no-github --format=json > features.diff.json - uses: actions/upload-artifact@v2 with: name: enumerate-features diff --git a/scripts/diff-features.js b/scripts/diff-features.js index 97a6d49b2fbfd0..a7fd6bc276d012 100644 --- a/scripts/diff-features.js +++ b/scripts/diff-features.js @@ -3,7 +3,7 @@ const fs = require('fs'); const yargs = require('yargs'); -function main({ ref1, ref2, format }) { +function main({ ref1, ref2, format, github }) { let refA, refB; if (ref1 === undefined && ref2 === undefined) { @@ -20,8 +20,8 @@ function main({ ref1, ref2, format }) { refB = `${ref1}`; } - let aSide = enumerate(refA); - let bSide = enumerate(refB); + let aSide = enumerate(refA, github === false); + let bSide = enumerate(refB, github === false); const results = { added: [...bSide].filter(feature => !aSide.has(feature)), @@ -35,13 +35,16 @@ function main({ ref1, ref2, format }) { } } -function enumerate(ref) { - try { - return new Set(getEnumerationFromGithub(ref)); - } catch { - console.error('Fetching artifact from GitHub failed. Using fallback.'); - return new Set(enumerateFeatures(ref)); +function enumerate(ref, skipGitHub) { + if (!skipGitHub) { + try { + return new Set(getEnumerationFromGithub(ref)); + } catch { + console.error('Fetching artifact from GitHub failed. Using fallback.'); + } } + + return new Set(enumerateFeatures(ref)); } function getEnumerationFromGithub(ref) { @@ -144,6 +147,10 @@ const { argv } = yargs.command( demand: 'a named format is required', default: 'markdown', }) + .option('no-github', { + type: 'boolean', + description: "Don't fetch artifacts from GitHub.", + }) .example('$0', 'compare HEAD to parent commmit') .example('$0 176d4ed', 'compare 176d4ed to its parent commmit') .example('$0 topic-branch main', 'compare a branch to main');