Skip to content

Commit

Permalink
metadata: Add codemeta validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed Dec 9, 2020
1 parent 0c6c21a commit 72451c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions invenio_github/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""Invenio module that adds GitHub integration to the platform."""

import github3
from convert_codemeta import crosswalk
from convert_codemeta import crosswalk, validate_codemeta
from flask import current_app
from invenio_db import db
from invenio_oauth2server.models import Token as ProviderToken
Expand Down Expand Up @@ -421,15 +421,17 @@ def extra_metadata(self):
@cached_property
def codemeta(self):
"""Get extra metadata from codemeta file in repository."""
metadata = get_extra_metadata(
codemeta = get_extra_metadata(
self.gh.api,
self.repository['owner']['login'],
self.repository['name'],
self.release['tag_name'],
'codemeta.json'
)
return crosswalk(metadata, "codemeta", "Zenodo")

if validate_codemeta(codemeta):
return crosswalk(codemeta, "codemeta", "Zenodo")
else:
return {}

@cached_property
def files(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
'Flask-Menu>=0.5.0',
'Flask>=1.0.4',
'WTForms-Alchemy>=0.15.0,<0.17',
'convert-codemeta>=0.2.0',
'convert-codemeta>=0.4.0',
'email-validator>=1.0.5',
'github3.py==1.0.0a4',
'humanize>=0.5.1',
Expand Down

0 comments on commit 72451c0

Please sign in to comment.