Expand description
Software citations (#614, ADR-0058): a GitHub release or tag cited as
@software, and which Zenodo DOI a software record is cited by.
Papers cite their code, often as a GitHub release with no DOI
(https://github.com/srwhite59/HFDMRG.jl/releases/tag/v0.1.0). cite
took DOIs and arXiv ids only, so those entries were written by hand.
What is read, and from where – only when the caller names a GitHub URL:
api.github.comGET /repos/{owner}/{repo}for the repository, then/releases/tags/{tag}(or/releases/latestfor a bare repository URL). A tag with no release falls back to the tag’s commit date (/commits/{tag}).raw.githubusercontent.com/{owner}/{repo}/{tag or HEAD}/CITATION.cff, the authors’ own statement of how to cite them. Its authors and title win over the repository’s owner and name.
CITATION.cff is YAML. Only its top-level scalars and the top-level
authors list are read (parse_cff), by a line reader rather than a
YAML crate: those are the fields a citation needs, CFF writers emit them
in plain block style, and anything the reader cannot follow is skipped,
never guessed – an unreadable file cites as if it were absent.
Structs§
- Cff
- What
CITATION.cffsays, as far as a citation needs it. - Github
Ref - A GitHub repository, optionally at a tag. The fields are private: only
GithubRef::parsemakes one from outside this module, so the owner, repository and tag always passed its checks before they are joined onto an API path (#649 review). - Software
Citation - A software citation resolved from GitHub.
Enums§
- Zenodo
Doi - Which DOI a Zenodo software record is cited by (#614).
Constants§
- GITHUB_
API - HTTP source key for the GitHub REST API.
- GITHUB_
API_ BASE_ ENV - Base-URL override for
GITHUB_API. - GITHUB_
RAW - HTTP source key for
raw.githubusercontent.com. - GITHUB_
RAW_ BASE_ ENV - Base-URL override for
GITHUB_RAW.
Functions§
- explain
- What a GitHub error means, when the status alone would mislead: a 403 is either the spent unauthenticated limit or a repository that is not public, and GitHub’s status does not say which.
- github_
resolves - Whether
gstill resolves: the repository, and the release or tag the URL names.Ok(false)for a 404 at either; transport failures are errors. - parse_
cff - Read the citation fields of a
CITATION.cff: top-leveltitle,version,doi,date-released, and the top-levelauthorslist. Nested blocks (preferred-citation,identifiers,references) are skipped, so their ownauthorsandtitleare never mistaken for the software’s. - resolve_
github - Resolve
gagainst GitHub: repository, release (or the tag’s commit), andCITATION.cff. - zenodo_
doi - Classify a DataCite record’s DOI by its
relatedIdentifiers: a version DOI pointsIsVersionOfat its concept; a concept DOIHasVersions.Nonewhen the record says neither (not Zenodo-style versioning).