Skip to content
book-open

GitHub Action

cff-validator

v3 Latest version

cff-validator

book-open

cff-validator

Validate your repository's CITATION.cff file using R software

Installation

Copy and paste the following snippet into your .yml file.

              

- name: cff-validator

uses: dieghernan/cff-validator@v3

Learn more about this action in dieghernan/cff-validator

Choose a version

cff-validator

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

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

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

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@v3
    with:
      citation-path: "examples/CITATION.cff"
  • cache-version: default 1. If you need to invalidate the existing cache pass any other number and a new cache will be used.

  • install-r: default false. If true download and install R during the setup. If false use the existing installation in the GitHub Action image.

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