Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dependency. The direct equivalent command is:
npm exec -- zenodraft metadata validate .zenodo.json
```

During export, OpenCite validates generated `.zenodo.json` metadata. ZIP exports include `METADATA_VALIDATION.txt` for downstream provenance checks.
During export, OpenCite validates generated `.zenodo.json` metadata. ZIP exports include `METADATA_VALIDATION.txt` for downstream provenance checks and `.github/workflows/validate-zenodo.yaml`, a GitHub Actions workflow that validates `.zenodo.json` with `zenodraft`. Dot-files and dot-folders (`.zenodo.json`, `.github`) may be hidden by file managers; enable "show hidden files" to see them.

### GitHub Pages deployment

Expand Down
6 changes: 4 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { toCitationCff } from './services/citation.js';
import { validateCitationCffText } from './services/citationValidation.js';
import { toZenodoJson } from './services/zenodo.js';
import { validateZenodoJsonText } from './services/zenodoValidation.js';
import { ZENODO_WORKFLOW_CONTENT, ZENODO_WORKFLOW_PATH } from './services/zenodoWorkflow.js';
import { hasMeaningfulMetadataValues, normalizeFormInput, validateMetadata } from './validation/validation.js';

const CITATION_FILENAME = 'CITATION.cff';
Expand Down Expand Up @@ -362,6 +363,7 @@ async function createMetadataZipBlob(citationPreview, zenodoPreview, validationR
zip.file(CITATION_FILENAME, citationPreview);
zip.file(ZENODO_FILENAME, zenodoPreview);
zip.file('METADATA_VALIDATION.txt', validationReport);
zip.file(ZENODO_WORKFLOW_PATH, ZENODO_WORKFLOW_CONTENT);

return zip.generateAsync({ type: 'blob' });
}
Expand Down Expand Up @@ -1431,11 +1433,11 @@ export default function App() {
disabled={isZipping}
>
{isZipping && <span className="button-spinner" aria-hidden="true" />}
{isZipping ? 'Creating ZIP…' : 'Download ZIP (Both Files)'}
{isZipping ? 'Creating ZIP…' : 'Download ZIP (All Files)'}
</button>
</div>
<p className="filename-note">
Keep the Zenodo filename as <strong>.zenodo.json</strong> for downstream tooling compatibility. The ZIP now includes <strong>METADATA_VALIDATION.txt</strong> with export checks.
Keep the Zenodo filename as <strong>.zenodo.json</strong> for downstream tooling compatibility. The ZIP now includes <strong>METADATA_VALIDATION.txt</strong> with export checks and a <strong>.github/workflows/validate-zenodo.yaml</strong> workflow that validates <strong>.zenodo.json</strong> on GitHub. Files and folders starting with a dot (like <strong>.zenodo.json</strong> and <strong>.github</strong>) may be hidden by your file manager; turn on "show hidden files" to see them.
</p>

<div className="preview">
Expand Down
26 changes: 26 additions & 0 deletions src/services/zenodoWorkflow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const ZENODO_WORKFLOW_PATH = '.github/workflows/validate-zenodo.yaml';

export const ZENODO_WORKFLOW_CONTENT = `name: Check zenodo metadata

on:
push:
paths:
- '.zenodo.json'
- '.github/workflows/validate-zenodo.yaml'

jobs:
check-zenodo-metadata:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install dependencies
run: npm install zenodraft@0.14.1
- name: Check .zenodo.json file
run: |
npx zenodraft metadata validate .zenodo.json
`;
12 changes: 12 additions & 0 deletions tests/services/zenodoWorkflow.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { ZENODO_WORKFLOW_CONTENT, ZENODO_WORKFLOW_PATH } from '../../src/services/zenodoWorkflow.js';

test('Zenodo validation workflow is placed in the GitHub workflows folder', () => {
assert.equal(ZENODO_WORKFLOW_PATH, '.github/workflows/validate-zenodo.yaml');
});

test('Zenodo validation workflow validates .zenodo.json with zenodraft', () => {
assert.match(ZENODO_WORKFLOW_CONTENT, /zenodraft metadata validate \.zenodo\.json/);
assert.match(ZENODO_WORKFLOW_CONTENT, /'\.github\/workflows\/validate-zenodo\.yaml'/);
});
Loading