Skip to content

Commit 01e12c2

Browse files
committed
Add local zenodo validation capabilities
1 parent 8aedea4 commit 01e12c2

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ docs: lint
44
-yek src/saev README.md AGENTS.md > docs/api/llms.txt
55
uv run mkdocs build --config-file docs/mkdocs.yml
66

7+
validate-zenodo:
8+
sh scripts/validation-zenodo.sh
9+
710
test:
811
uv run pytest -m "not slow and not integration" tests
912

scripts/validation-zenodo.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
# Validate .zenodo.json with the same pinned zenodraft as CI.
3+
4+
set -eu
5+
6+
workflow=".github/workflows/validate-zenodo.yaml"
7+
8+
# e.g. "zenodraft@0.14.1" from the `npm install zenodraft@0.14.1` line.
9+
spec=$(grep -oE 'zenodraft@[0-9]+\.[0-9]+\.[0-9]+' "$workflow" | head -n 1)
10+
if [ -z "$spec" ]; then
11+
echo "could not read pinned zenodraft version from $workflow" >&2
12+
exit 1
13+
fi
14+
15+
if command -v npx >/dev/null 2>&1; then
16+
exec npx "$spec" metadata validate .zenodo.json
17+
elif command -v bunx >/dev/null 2>&1; then
18+
exec bunx "$spec" metadata validate .zenodo.json
19+
elif command -v dx >/dev/null 2>&1; then
20+
exec dx "$spec" metadata validate .zenodo.json
21+
elif command -v deno >/dev/null 2>&1; then
22+
exec deno run --allow-read "npm:$spec" metadata validate .zenodo.json
23+
else
24+
echo "no JS runner found (tried: npx bunx dx deno)" >&2
25+
exit 1
26+
fi

0 commit comments

Comments
 (0)