Refresh xkcd data #3
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: Refresh xkcd data | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: yarn | |
cache-dependency-path: yarn.lock | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Cache data | |
uses: actions/cache@v3 | |
with: | |
path: data/raw | |
key: data-raw | |
- name: Run script | |
env: | |
TYPESENSE_HOST: ${{ env.TYPESENSE_HOST }} | |
TYPESENSE_PORT: ${{ env.TYPESENSE_PORT }} | |
TYPESENSE_PROTOCOL: ${{ env.TYPESENSE_PROTOCOL }} | |
TYPESENSE_ADMIN_API_KEY: ${{ secrets.TYPESENSE_ADMIN_API_KEY }} | |
run: | | |
find data/raw -name "*.html" -type f -exec grep -l "explanation may be incomplete" {} + | xargs -r rm | |
yarn fetchData | |
find data/raw -name "*.html" -type f -exec grep -l "server is temporarily unable" {} + | xargs -r rm | |
yarn refreshData |