Skip to content

feat: crawl docs immediately after PR is created or merged #2

feat: crawl docs immediately after PR is created or merged

feat: crawl docs immediately after PR is created or merged #2

Workflow file for this run

name: Algolia Crawler
on:
push:
branches: [ main ]
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
jobs:
algolia_recrawl:
name: Algolia Recrawl
runs-on: ubuntu-latest
steps:
# checkout this repo
- name: Checkout Repo
uses: actions/checkout@v2
# We don't know when the site will be deployed, we just wait a few seconds
# Better solutions can be found
- name: Sleep for 90s
run: sleep 90
# For PRs
- name: PR => Algolia crawler creation and recrawl on preview (Pull Request)
if: github.ref != 'refs/heads/main'
uses: algolia/algoliasearch-crawler-github-actions@v1
id: crawler_pr
with:
crawler-user-id: ${{ secrets.CRAWLER_USER_ID }}
crawler-api-key: ${{ secrets.CRAWLER_API_KEY }}
algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }}
algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }}
site-url: 'https://${{ github.head_ref || github.ref_name }}.india-compliance-docs.pages.dev/'
override-config: true
# For main branch
- name: MAIN => Algolia crawler creation and recrawl (Push on Main branch)
if: github.ref == 'refs/heads/main'
uses: algolia/algoliasearch-crawler-github-actions@v1
id: crawler_push
with:
crawler-user-id: ${{ secrets.CRAWLER_USER_ID }}
crawler-api-key: ${{ secrets.CRAWLER_API_KEY }}
algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }}
algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }}
site-url: 'https://docs.indiacompliance.app/'
override-config: true