-
Notifications
You must be signed in to change notification settings - Fork 25
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
Badges doi #141
Conversation
kpsherva
commented
Oct 16, 2023
- closes https://github.com/zenodo/rdm-project/issues/354
invenio_github/views/badge.py
Outdated
title="DOI", | ||
value=pid.pid_value, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 %} |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.:
There was a problem hiding this comment.
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)
338cd9a
to
347e808
Compare
release_object = repo.latest_release(ReleaseStatus.PUBLISHED) | ||
release_instance = current_github.release_api_class(release_object) | ||
if release_object: |
There was a problem hiding this comment.
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)
347e808
to
0c86d65
Compare