Skip to content

Commit 4f2fde6

Browse files
committed
Set config after upload
1 parent 38385c6 commit 4f2fde6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/upload-algolia.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,19 @@
2020

2121
# The API client automatically batches your records
2222
index.replace_all_objects(records, {})
23+
24+
# Apply settings from config file
25+
configFile = File.read('.github/workflows/algolia-config.json')
26+
config = JSON.parse(configFile)
27+
28+
index.set_settings(config['settings'])
29+
30+
# Apply synonyms if present
31+
if config['synonyms'] && !config['synonyms'].empty?
32+
index.save_synonyms(config['synonyms'], { replaceExistingSynonyms: true })
33+
end
34+
35+
# Apply rules if present
36+
if config['rules'] && !config['rules'].empty?
37+
index.save_rules(config['rules'], { clearExistingRules: true })
38+
end

0 commit comments

Comments
 (0)