Automatic Re-Indexing of New Content

We all push updates to our documentation regularly, and we want to make sure our search results are always up-to-date. While you're able to manually trigger a re-index from the WOPR dashboard, in production environments, we recommend that you set up a Github Action to do this for you whenever you make changes to a production branch.

In .github/workflows/wopr.yaml, add the following:

name: WOPR (Re-Indexing Trigger)
on:
  push:
    branches:
      - main # or whatever branch you're using
jobs:
  reindex:
    runs-on: ubuntu-latest
    steps:
      - name: curl
        uses: wei/curl@v1.1.1
        with:
          args: -X POST -H 'Content-Type: application/json' -d '{"project_id":"${{ secrets.WOPR_PROJECT_ID }}"}' -H 'Authorization:${{ secrets.WOPR_SECRET_KEY }}' https://wopr-api.operand.ai/services.project.v1.ProjectService/ReIndexProject

Then, you'll want to set the following two secrets in your Github Actions secrets:

  • WOPR_PROJECT_ID: The ID of the project you want to re-index.
  • WOPR_SECRET_KEY: The secret key for the project.

That's it! You can now trigger a re-index from Github Actions whenever you make changes to your production branch.