Algolia Crawler #763
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Algolia Crawler | |
on: | |
workflow_run: | |
workflows: ["Release to Production"] | |
types: [completed] | |
workflow_dispatch: | |
env: | |
ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_V3_USER_ID }} | |
ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_V3_API_KEY }} | |
CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_V3_ID }} | |
jobs: | |
docsearch: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# - name: Run scraper | |
# env: | |
# APPLICATION_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
# API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} | |
# run: docker run -e APPLICATION_ID=$APPLICATION_ID -e API_KEY=$API_KEY -e "CONFIG=$(cat ./docsearch.config.json | jq -r tostring)" algolia/docsearch-scraper | |
- name: Trigger DocSearch v3 Crawler | |
run: | | |
curl -H "Content-Type: application/json" -X POST --user ${ALGOLIA_CRAWLER_USER_ID}:${ALGOLIA_CRAWLER_API_KEY} "https://crawler.algolia.com/api/1/crawlers/${CRAWLER_ID}/reindex" | |
- name: Slack Notification | |
if: ${{ failure() }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_USERNAME: "spectromate" | |
SLACK_ICON_EMOJI: ":robot_panic:" | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: 'The Docs Algolia crawler job failed. Please check the GitHub Actions logs for more details.' |