Books #38728
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: Books | |
on: | |
push: | |
paths: | |
- .github/workflows/books.yml # Only run a new workflow every time this file (flat.yaml) file changes | |
workflow_dispatch: # Required even though this is currently empty | |
schedule: | |
- cron: "*/30 * * * *" # Run this workflow every 5 minutes | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Setup deno | |
uses: denoland/setup-deno@main | |
with: | |
deno-version: v1.x | |
- name: Get API token | |
id: get-api-token | |
run: | | |
token=$(curl 'https://www.italictype.com/api/auth/jwt/create/' \ | |
-X POST \ | |
-H 'accept: application/json, text/plain, */*' \ | |
-H 'content-type: application/json;charset=UTF-8' \ | |
--data-raw '{"username":"yannick","password":"${{ secrets.ITALICTYPE_PASSWORD }}"}' | jq -r .access) | |
echo "::set-output name=italictype_token::${token}" | |
- name: Fetch ItalicType data | |
uses: githubocto/flat@v3 | |
with: | |
http_url: "https://www.italictype.com/api/bookqueueitems/?queue=1" | |
downloaded_filename: data/italictype_current.json | |
authorization: "Bearer ${{ steps.get-api-token.outputs.italictype_token }}" | |
postprocess: flat/italictype_current.ts | |
- name: Fetch ItalicType data | |
uses: githubocto/flat@v3 | |
with: | |
http_url: "https://www.italictype.com/api/bookqueueitems/?queue=2&limit=2000" | |
downloaded_filename: data/italictype.json | |
authorization: "Bearer ${{ steps.get-api-token.outputs.italictype_token }}" | |
postprocess: flat/italictype.ts |