Ingest journals #16
This file contains hidden or 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: Ingest journals | |
| # Rebuilds lib/journals/generated.ts from open APIs (OpenAlex + DOAJ) and commits | |
| # the refreshed dataset back to main. Runs monthly and on demand. The curated | |
| # data (lib/journals/*.ts) is never touched — the finder merges curated over | |
| # ingested at runtime. See docs/JOURNAL_INGESTION.md. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| max: | |
| description: "Max journals to write" | |
| required: false | |
| default: "60000" | |
| schedule: | |
| # 03:00 UTC on the 1st of every month. | |
| - cron: "0 3 1 * *" | |
| # Needed to commit the regenerated dataset back to the repo. | |
| permissions: | |
| contents: write | |
| # Avoid overlapping ingests stomping on each other's commit. | |
| concurrency: | |
| group: ingest-journals | |
| cancel-in-progress: false | |
| jobs: | |
| ingest: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| - run: npm ci | |
| - name: Ingest journals (OpenAlex + DOAJ) | |
| env: | |
| SCHOLARLY_MAILTO: ${{ secrets.SCHOLARLY_MAILTO || 'research@medcore.app' }} | |
| run: node scripts/ingest-journals.mjs --max ${{ github.event.inputs.max || '60000' }} | |
| - name: Typecheck generated dataset | |
| # Catches a malformed generated.ts before it is committed. | |
| run: npx tsc --noEmit | |
| - name: Commit refreshed dataset if changed | |
| run: | | |
| if git diff --quiet -- lib/journals/generated.ts; then | |
| echo "No journal changes — nothing to commit." | |
| exit 0 | |
| fi | |
| git config user.name "medcore-ingest-bot" | |
| git config user.email "actions@github.com" | |
| git add lib/journals/generated.ts | |
| git commit \ | |
| -m "chore(journals): refresh ingested dataset [skip ci]" \ | |
| -m "Auto-generated by scripts/ingest-journals.mjs (OpenAlex + DOAJ)." | |
| git push origin HEAD:main |