Skip to content

Update Word List

Update Word List #60

name: Update Word List
on:
schedule:
# The latest time when there's still an inhabited place (UTC-10) that hasn't rolled over to the next day is at 09:59 UTC.
# The latest time when there's still an uninhabited place (UTC-12) that hasn't rolled over to the next day is at 11:59 UTC.
# Observed update of source is between 4:00 AM and 4:20 AM PDT, 11:00 and 11:20 UTC.
- cron: '*/10 * * * *' # Runs at 12:07 UTC every day, 5:07 AM PDT.
workflow_dispatch: # Allows manual triggering
jobs:
update-gist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run scraper and update Gist
shell: bash
env:
USED_WORDS_SOURCE_URL: ${{ secrets.USED_WORDS_SOURCE_URL }}
GIST_UPDATE_TOKEN: ${{ secrets.GIST_UPDATE_TOKEN }}
GIST_ID: ${{ secrets.GIST_ID }}
run: |
set +e # Allow script to continue on non-zero exit codes
echo "Entered workflow run: block"
for i in {1..3} # Loop max 3 times
do
node scripts/update-used-words.js
if [ $? -eq 0 ]; then
echo "Resource updated, exiting."
exit 0
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manual trigger detected, exiting."
exit 2
fi
echo "Resource not updated, sleeping for 1 minute"
sleep 60
done
echo "Resource update not detected within time limit."
exit 1