Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges doi #141

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Badges doi #141

merged 2 commits into from
Oct 16, 2023

Conversation

kpsherva
Copy link
Contributor

Comment on lines 60 to 61
title="DOI",
value=pid.pid_value,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pid in this case, is it the DOI or the RECID? That depends on what the GitHubRelease.pid class has configured in invenio-rdm. And I also see that the class above is not "dynamically" picked up using the GITHUB_RELEASE_CLASS config.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the solution is to implement a badge_pid property on the GitHubRelease class, and in RDM Records resolve and return the DOI PersistentIdentifier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have this (badge_title and badge_value) and both are meant to work with DOI. Unfortunately, it was only enabled for the new badge endpoint, not the older ones ...

I think we only need to fix this in invenio-github

@@ -16,10 +16,6 @@
{%- set github_rel_url = 'https://github.com/{0}/releases/new'.format(repo.name) %}
{% set active = true %}

{%- if latest_published %}
Copy link
Member

@alejandromumo alejandromumo Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anywhere ... in fact latest_published is not even a view arg

@@ -41,34 +42,6 @@
)


# Kept for backward compatibility
def get_pid_of_latest_release_or_404(**kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue here was that all of these were copy / pasted from legacy and were not properly adapted to the new architecture. E.g.:

  • Badge title: will be DOI if datacite is enabled (like on Zenodo)
  • Badge value: will take the DOI identifier from record pids if Datacite is enabled
  • Record url: will be either the record DOI URL if the record has one, otherwise it's HTML url

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use these, which are already in place, we can remove this legacy logic based on pid and some hardcoded stuff (e.g. doi URL)

release_object = repo.latest_release(ReleaseStatus.PUBLISHED)
release_instance = current_github.release_api_class(release_object)
if release_object:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release object might not exist since latest_release returns an object from query.first(). This could lead to problems further down the road.

I modified the calls to repo_last_published_release to either get the release instance or throw an error (usually in the presentation layer throws a 404)

@alejandromumo alejandromumo requested a review from slint October 16, 2023 10:54
@zzacharo zzacharo merged commit 9932fa6 into inveniosoftware:master Oct 16, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants