Skip to content

cff-validator

Actions
Validate your repository s CITATION.cff file using R software
v4
Latest
Star (12)

cff-validator

latest-version CITATION-cff full-test-action DOI

A GitHub action to validate CITATION.cff files with R.

Breaking change: v4 only works on Linux, upgrade your v3 to run on ubuntu-*.

Introduction

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@v4

On error, the action produces a Job Summary with a high-level description of the errors found:

citation_cff.md

❌ CITATION.cff has errors

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.

Add a badge to your repo

You can easily create a badge showing the current status of validation of your CITATION.cff like this:

CITATION.cff

CITATION-cff error

See a quick demo:

Demo gif showing how to create a badge for a GH action

Inputs available

  • citation-path: Path to .cff file to be validated. By default it selects a CITATION.cff file on the root of the repository:
  - name: Validate CITATION.cff
    uses: dieghernan/cff-validator@v4
    with:
      citation-path: "examples/CITATION.cff"
  • (Soft) Deprecated parameters in v4:

    • cache-version

    • install-r.

See a full featured implementation on this example.

For useRs

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.

References

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

cff-validator is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Validate your repository s CITATION.cff file using R software
v4
Latest

cff-validator is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.