GitHub Action
cff-validator
A GitHub action to validate CITATION.cff
files with R.
If you have a Citation File Format (cff) on your repository this action would check its validity against the defined schema.
A full valid workflow:
on:
push:
paths:
- CITATION.cff
workflow_dispatch:
name: CITATION.cff
jobs:
Validate-CITATION-cff:
runs-on: ubuntu-latest
name: Validate CITATION.cff
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate CITATION.cff
uses: dieghernan/cff-validator@v3
On error, the action produces a Job Summary with a high-level description of the errors found:
citation_cff_errors.md
field | message |
---|---|
data | has additional properties |
data.authors.0 | no schemas match |
data.doi | referenced schema does not match |
data.keywords.0 | is the wrong type |
data.license | referenced schema does not match |
data.url | referenced schema does not match |
See Guide to Citation File Format schema version 1.2.0 for debugging.
For more examples, see the actions provided on this path.
You can easily create a badge showing the current status of validation of your
CITATION.cff
like this:
See a quick demo:
citation-path
: Path to .cff file to be validated. By default it selects aCITATION.cff
file on the root of the repository:
- name: Validate CITATION.cff
uses: dieghernan/cff-validator@v3
with:
citation-path: "examples/CITATION.cff"
-
cache-version
: default1
. If you need to invalidate the existing cache pass any other number and a new cache will be used. -
install-r
: defaultfalse
. Iftrue
download and install R during the setup. Iffalse
use the existing installation in the GitHub Action image.
See a full featured implementation on this example.
This action runs on R. For the same functionality you can use the cffr package:
cffr::cff_validate("CITATION.cff")
#>
#> cff_validate results——
#> Congratulations! This .cff file is valid
See
cffr::cff_validate()
for details.
Druskat, S., Spaaks, J. H., Chue Hong, N., Haines, R., Baker, J., Bliven, S., Willighagen, E., Pérez-Suárez, D., & Konovalov, A. (2021). Citation File Format (Version 1.2.0) [Computer software]. https://doi.org/10.5281/zenodo.5171937