Skip to content

Commit 3b16a63

Browse files
Add Algolia indexer Github Action and config. (base#67)
* Add Algolia indexer Github Action and config. * Fix level 6 selector.
1 parent 1b34afa commit 3b16a63

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Update Algolia Search Results'
2+
on:
3+
# Allows you to run this workflow manually from the Actions tab
4+
workflow_dispatch:
5+
schedule:
6+
# The CRON duration for the job: At 2:30 AM UTC MON-FRI
7+
- cron: '30 2 * * 1-5'
8+
9+
# permission can be added at job level or workflow level
10+
permissions:
11+
id-token: write
12+
contents: read # This is required for actions/checkout
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
- name: Get the content of algolia.json as config
21+
id: algolia_config
22+
run: echo "::set-output name=config::$(cat apps/base-docs/algolia.json | jq -r tostring)"
23+
- name: Push indices to Algolia
24+
uses: signcl/docsearch-scraper-action@master
25+
env:
26+
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
27+
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
28+
CONFIG: ${{ steps.algolia_config.outputs.config }}

apps/base-docs/algolia.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"index_name": "prod",
3+
"start_urls": [
4+
"https://docs.base.org"
5+
],
6+
"sitemap_urls": [
7+
"https://docs.base.org/sitemap.xml"
8+
],
9+
"selectors": {
10+
"default": {
11+
"lvl0": "article h1",
12+
"lvl1": "article h2",
13+
"lvl2": "article h3",
14+
"lvl3": "article h4",
15+
"lvl4": "article h5",
16+
"lvl5": "article td:first-child",
17+
"lvl6": "article td:not(td:first-child)",
18+
"text": "article p, article li"
19+
}
20+
},
21+
"strip_chars": " .,;:#"
22+
}

0 commit comments

Comments
 (0)