Skip to content

Commit

Permalink
Update algolia daily on changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonis committed Oct 2, 2024
1 parent 8052c09 commit 9096073
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/update-algolia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update the Algolia search index
on:
workflow_dispatch:
schedule:
- cron: "0 16 * * Sun"
- cron: "0 2 * * *"

jobs:
build:
Expand All @@ -18,7 +18,20 @@ jobs:
with:
bundler-cache: true
working-directory: website
- name: Check recent commit
id: checkcommit
run: |
LASTEST_COMMIT=$(git log -1 --format=%ct)
CURRENT_TIME=$(date +%s)
TIME_DIFF=$((CURRENT_TIME - LATEST_COMMIT))
if [ $TIME_DIFF -gt 86400 ]; then
echo "No commit within 24 hours."
echo "recent_commit=false" >> "$GITHUB_OUTPUT"
else
echo "recent_commit=true" >> "$GITHUB_OUTPUT"
fi
- name: Build website and update Algolia index
if: ${{ github.event_name == 'workflow_dispatch' || steps.checkcommit.outputs.recent_commit == 'true' }}
working-directory: website
env:
JEKYLL_ENV: production
Expand Down

0 comments on commit 9096073

Please sign in to comment.