Skip to content

Commit dae25d4

Browse files
authored
Fix algolia indexing skipping (#9482)
1 parent 5d31f98 commit dae25d4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extensions/export-content-extension.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ module.exports.register = function () {
1717
await fsPromises.writeFile(outPath, JSON.stringify({ pages }, null, 2));
1818
console.log(`Wrote JSON to ${outPath}`);
1919

20-
if (!shouldSkipIndexing() && !hasIndexed(tempDir) && hasAlgoliaCredentials()) {
20+
if (shouldSkipIndexing()) {
21+
console.log('Skipping Algolia indexing (requested by configuration)');
22+
return;
23+
}
24+
25+
if (!hasIndexed(tempDir) && hasAlgoliaCredentials()) {
2126
try {
2227
await indexToAlgolia(pages);
2328
await fsPromises.writeFile(path.join(tempDir, 'algolia-indexed.marker'), new Date().toISOString());
@@ -102,7 +107,7 @@ function getNavEntriesByUrl(items = [], accum = {}, trail = []) {
102107

103108
function shouldSkipIndexing() {
104109
if (process.env.CI === 'true') {
105-
return process.env.CIRCLE_BRANCH === 'main';
110+
return process.env.CIRCLE_BRANCH !== 'main';
106111
}
107112

108113
const val = (process.env.SKIP_INDEX_SEARCH || '').toLowerCase();

0 commit comments

Comments
 (0)