mirror of
https://staging.allspice.dev/AllSpice-Demos/Actions-demo.git
synced 2025-04-23 17:03:42 +00:00
Replace DIY with JSON
This commit is contained in:
parent
d0438a99db
commit
1ed402ceac
@ -2,7 +2,9 @@
|
||||
# Uses py-allspice + AllSpice API to save all design review comments to a markdown file
|
||||
from allspice import AllSpice, DesignReview, Repository
|
||||
import argparse
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
print("Starting Test")
|
||||
@ -63,10 +65,13 @@ def write_to_file(file_name, string):
|
||||
# Get the repository object
|
||||
repository = Repository.request(allspice, "AllSpice-Demos", "Actions-demo")
|
||||
|
||||
# Build a string of attributes, separated by newlines
|
||||
attributes_string = os.linesep.join(f"Repository.{attribute}={repository.attribute}" for attribute in get_attributes(repository))
|
||||
attributes = get_attributes(repository)
|
||||
repository_dict = {attribute: getattr(repository, attribute) for attribute in attributes}
|
||||
|
||||
# Write the attributes to the file
|
||||
write_to_file(file_name, attributes_string)
|
||||
# Convert the repository dictionary to a JSON string
|
||||
repository_json = json.dumps(repository_dict, indent=4)
|
||||
|
||||
# Write the JSON string to a file
|
||||
write_to_file(file_name, repository_json)
|
||||
|
||||
print("End-of-file")
|
Loading…
Reference in New Issue
Block a user