Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/collect-user-submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@ class IssueInfo:
gh_event_path: pydantic.FilePath
submission: Submission = pydantic.Field(default=None)

def __post_init_post_parse__(self):
with open(self.gh_event_path) as f:
self.data = json.load(f)

def create_submission(self):
self._get_inputs()
self._create_submission_input()
return self

def _get_inputs(self):
with open(self.gh_event_path) as f:
self.data = json.load(f)

self.author = self.data['issue']['user']['login']
self.title = self.data['issue']['title']
self.body = self.data['issue']['body']
Expand All @@ -61,8 +60,8 @@ def _create_submission_input(self):
authors.append(
Author(
name=item.get('name', 'anyonymous'),
affiliation=item.get('affiliation'),
affiliation_url=item.get('affiliation_url'),
affiliation=item.get('institution'),
affiliation_url=item.get('institution_url'),
Copy link
Contributor

Choose a reason for hiding this comment

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

A thought: should we update the form template and card text to all use "Affiliation" regardless? It seems more broadly applicable than "Institution" and is in-line with expected fields in eg CITATION.cff.

Copy link
Member Author

@erogluorhan erogluorhan Dec 26, 2023

Choose a reason for hiding this comment

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

Yes, I agree! We can do that in conjunction with this PR

Copy link
Member Author

@erogluorhan erogluorhan Dec 26, 2023

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

...and also the gallery_generator.py and resource_gallery.yaml files here for "institution" to "affiliation" changes

email=item.get('email', ''),
)
)
Expand All @@ -78,6 +77,6 @@ def _create_submission_input(self):

if __name__ == '__main__':
issue = IssueInfo(gh_event_path=os.environ['GITHUB_EVENT_PATH']).create_submission()
inputs = issue.submission.dict()
inputs = issue.submission.model_dump_json()
with open('resource-gallery-submission-input.json', 'w') as f:
json.dump(inputs, f)