Skip to content
Open
Changes from all 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
38 changes: 19 additions & 19 deletions .github/scripts/update_doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,35 @@
commit_message = "Update nci_iso.csv with DOI"
repo.update_file(csv_file_path, commit_message, updated_csv_content, file_content.sha)

# YAML
yaml = YAML(typ=['rt', 'string'])
yaml.preserve_quotes = True
yaml.indent(mapping=2, sequence=4, offset=2)
## YAML
#yaml = YAML(typ=['rt', 'string'])
#yaml.preserve_quotes = True
#yaml.indent(mapping=2, sequence=4, offset=2)

# Read existing file
yaml_file_path = ".website_material/index.md"
web_yaml_dict = read_yaml_with_header(yaml_file_path)
#yaml_file_path = ".website_material/index.md"
#web_yaml_dict = read_yaml_with_header(yaml_file_path)

# Path to key to update
#key_path = "dataset.doi"
#add doi to the top level only
key_path = "doi"
#key_path = "doi"
# Update value
navigate_and_assign(web_yaml_dict, key_path, doi)
key_path = "creditText"
#navigate_and_assign(web_yaml_dict, key_path, doi)
#key_path = "creditText"
# Update value
navigate_and_assign(web_yaml_dict, key_path, citation_str)
#navigate_and_assign(web_yaml_dict, key_path, citation_str)

# Use an in-memory text stream to hold the YAML content
stream = io.StringIO()
stream.write("---\n")
yaml.dump(web_yaml_dict, stream)
stream.write("---\n")
yaml_content_with_frontmatter = stream.getvalue()

file_content = repo.get_contents(yaml_file_path)
commit_message = "Update YAML file with DOI"
repo.update_file(yaml_file_path, commit_message, yaml_content_with_frontmatter, file_content.sha)
#stream = io.StringIO()
#stream.write("---\n")
#yaml.dump(web_yaml_dict, stream)
#stream.write("---\n")
#yaml_content_with_frontmatter = stream.getvalue()

#file_content = repo.get_contents(yaml_file_path)
#commit_message = "Update YAML file with DOI"
#repo.update_file(yaml_file_path, commit_message, yaml_content_with_frontmatter, file_content.sha)

# Print True to indicate success so that files may be copied to website repo
print(True)
Expand Down