xarray-contrib/cf-xarray

autoupdate CITATION.cff

Opened this issue · 10 comments

So the CITATION.cff points to an old version:

doi: 10.5281/zenodo.4749736
repository-code: https://github.com/xarray-contrib/cf-xarray
license: Apache-2.0
version: 0.5.2

I've been hitting this issue before when I used CITATION.cff to point to a zenodo repo. I thought I could add the "cite all versions zenodo link", e.g., 10.5281/zenodo.4749735. But then the version in the CITATION.cff file wouldn't be updated... I thought that surely there should be a way that the version of CITATION.cff is updated every time there is a new release but I haven't figured it out.

Any thoughts or solutions to this issue?

No! I keep looking too, it seems like a no-brainer.

It seems like we need a github action to use doi2cff (https://github.com/citation-file-format/doi2cff) and open a PR.

Maybe @keewis is interested in implementing this :)

If you implement a github action that auto updates the cff file on every release I’m definitely copying it!

keewis commented

if I understand correctly, we'd need a post-release workflow that queries zenodo to find the doi of the most recent release and creates a PR from that (using doi2cff). Does that sound about right?

I wonder if we should try to push this into the zenodo webhook?

Edit: actually, the referencing issue above mentions a script that does all the tricky parts (fetch the doi of the most recent release): newhinton/Zettlr@d8d9edb

Well it's a bit circular that way.

IMO we want to update CITATION.cff for every PR from a new contributor. That way CITATION.cff is updated at release time and the Zeonodo metadata will be correct.

keewis commented

I don't think we can automate adding new contributors to the authors: Where would you get the information to put into CITATION.cff from? AFAICT, the only thing we would be able to get without the help of the contributor is the github handle, which does not seem to be part of CITATION.cff (and some people might not want to be part of that file). So I think the only thing we can do is ask each new contributor to add their information manually to CITATION.cff or a special file that can be synchronized with CITATION.cff (AUTHORS.yaml).

For the version / doi, I agree, this is a bit circular. To make it less circular, we'd have to: create a new doi and put that and the new version into CITATION.cff, then create a commit and tag it as the release, and only after that do the usual uploading to pypi and zenodo. I don't think that's possible, though.

Of course, that assumes the authors don't have to be modified on release as well, but the case where you want to collect authors that contributed to a specific release can be easily implemented by clearing the authors after each release, and have another action add contributors from AUTHORS.yaml on the first PR after the release.

I used https://con.github.io/tributors/docs/getting-started in #399

I can't remember now but it is bootstrap-able. You can create a CITATION.cff entry using First Name, Last Name, possible affiliation from github data basically. And ask the contributor to update the rest

You can always make the CFF point to the "cite-all-versions" zenodo DOI.
This way you only need somehow to auto-update the version in the CFF file, right?

keewis commented

If we can use the "cite-all-versions" doi that makes it much simpler. I wonder if creating a pre-commit hook that checks the changelog for version sections with dates and synchronizes that with the version in CITATION.cff would be sufficient?

For example, the commit that changes the version section from

v1.0.1 (*unreleased*)
---------------------

to

v1.0.1 (2023-04-02)
-------------------

would automatically be detected as a release commit and the hook would update CITATION.cff to point to 1.0.1 (run either through the local pre-commit install and included in the release commit, or as a new commit created by pre-commit-ci).

You can always make the CFF point to the "cite-all-versions" zenodo DOI.

yes just did this.

ou only need somehow to auto-update the version in the CFF file,

Ah now I see the confusion. I had totally forgotten that there is a version and release date in CITATION.cff. This is OK to be manual, it can be part of the release process.

I think it's most important to be prompted to add a new contributor to CITATION.cff. I think the easiest place to do this is when a PR is opened. Or perhaps when its merged, then an action can open a PR to update CITATION.cff, and ping the author to check for corrections and add info.