Skip to content

update algolia

update algolia #400

name: update algolia
on:
workflow_run:
workflows: [pages-build-deployment]
types:
- completed
# Allows you to run this Workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Push indices to Algolia
env:
CRAWLER_USER_ID: ${{ vars.CRAWLER_USER_ID }}
CRAWLER_API_KEY: ${{ secrets.CRAWLER_API_KEY }}
run: |
# Trigger the crawler
crawler_id="$(curl -sH "Content-Type: application/json" \
--user ${CRAWLER_USER_ID}:${CRAWLER_API_KEY} \
"https://crawler.algolia.com/api/1/crawlers/" | \
jq -r '.items[0].id')"
curl -H "Content-Type: application/json" -X POST \
--user ${CRAWLER_USER_ID}:${CRAWLER_API_KEY} \
"https://crawler.algolia.com/api/1/crawlers/${crawler_id}/reindex"