Skip to content

Example protocols

Example protocols #383

Workflow file for this run

name: Example protocols
on:
schedule:
# Runs at 00:00 UTC every Monday
- cron: 0 0 * * 1,4
workflow_dispatch:
pull_request:
paths:
- scripts/generate-protocols.js
- scripts/add-species-from-jessica-joachim.ts
- scripts/add-species-from-google-slides.js
- scripts/add-taxonomic-parents-from-gbif.js
- .github/workflows/protocols.yml
push:
branches:
- renovate/googleapis-*
- renovate/google-auth-library-*
- renovate/rss-parser-*
- renovate/jsdom-*
- renovate/tinyexec-*
- renovate/pdf-to-png-converter-*
- renovate/odt2html-*
- renovate/turndown-*
- renovate/marked-*
jobs:
regenerate:
if: github.event.pull_request.draft == false
name: Regenerate
runs-on: ubuntu-latest
concurrency:
group: regenerate-example-protocols
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ssh-key: ${{ secrets.AUTOCOMMITS_DEPLOY_KEY }}
- name: Setup Node.js
uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Initialize protocol
run: bun run scripts/generate-protocols.js
- name: Add species descriptions from JJ
run: bun run scripts/add-species-from-jessica-joachim.ts species
- name: Set google-drive-key.json
uses: mobiledevops/secret-to-file-action@v1
with:
base64-encoded-secret: ${{ secrets.GOOGLE_DRIVE_KEY_BASE64 }}
filename: google-drive-key.json
is-executable: false
working-directory: ./
- name: Add data from Google Slides folder
run: bun run scripts/add-species-from-google-slides.js
- name: Unset google-drive-key.json
run: rm google-drive-key.json
- name: Add data from GBIF
run: bun run scripts/add-taxonomic-parents-from-gbif.ts
- name: Add genus descriptions from JJ
run: bun run scripts/add-species-from-jessica-joachim.ts genus
- name: Clean old protocol
run: rm examples/old-*.json
- name: Format generated protocols
run: bun x prettier --write examples/*.cigaleprotocol.json
- name: Setup diffing that ignores version and learnMore fields
run: git config diff.example-protocols.textconv "$textconv"
env:
textconv: jq 'del(.version) | del(.learnMore)' $1
- name: Pull in case main has changed since we started
if: github.event_name == 'push' && github.ref_name == 'main'
run: git pull origin main --rebase --autostash
- name: Check for changes
id: status
run: |
git diff || true
echo "changed=$(git diff --quiet && echo false || echo true)" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.status.outputs.changed == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: 🍱 Regenerate example protocols
file_pattern: examples/*.cigaleprotocol.{json,images/*}