Skip to content

Commit

Permalink
Add Algolia indexer Github Action and config. (#67)
Browse files Browse the repository at this point in the history
* Add Algolia indexer Github Action and config.

* Fix level 6 selector.
  • Loading branch information
jacob-moore-cb authored Oct 13, 2023
1 parent 1b34afa commit 3b16a63
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/update-algolia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Update Algolia Search Results'
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
# The CRON duration for the job: At 2:30 AM UTC MON-FRI
- cron: '30 2 * * 1-5'

# permission can be added at job level or workflow level
permissions:
id-token: write
contents: read # This is required for actions/checkout

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get the content of algolia.json as config
id: algolia_config
run: echo "::set-output name=config::$(cat apps/base-docs/algolia.json | jq -r tostring)"
- name: Push indices to Algolia
uses: signcl/docsearch-scraper-action@master
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
CONFIG: ${{ steps.algolia_config.outputs.config }}
22 changes: 22 additions & 0 deletions apps/base-docs/algolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"index_name": "prod",
"start_urls": [
"https://docs.base.org"
],
"sitemap_urls": [
"https://docs.base.org/sitemap.xml"
],
"selectors": {
"default": {
"lvl0": "article h1",
"lvl1": "article h2",
"lvl2": "article h3",
"lvl3": "article h4",
"lvl4": "article h5",
"lvl5": "article td:first-child",
"lvl6": "article td:not(td:first-child)",
"text": "article p, article li"
}
},
"strip_chars": " .,;:#"
}

0 comments on commit 3b16a63

Please sign in to comment.