diff --git a/Parsing_new_package_diff/parse_diff.py b/Parsing_new_package_diff/parse_diff.py index 092c2b7a..73be21b7 100644 --- a/Parsing_new_package_diff/parse_diff.py +++ b/Parsing_new_package_diff/parse_diff.py @@ -5,10 +5,8 @@ \+: matches + sign. \s*: matches whitespace between + and other text. - matches hypen. title: matches title. (.*?): Matches package name. "\n:" matches newline. \+ matches plus sign. again (.*?) to capture version """ - def parse_diff(diff): new_packages = [] - # Regex to find lines with new packages package_pattern = re.compile(r'^\+\s*-\s*title:\s*(.*?)\n\+\s*version:\s*(.*?)$', re.MULTILINE) matches = package_pattern.findall(diff) @@ -21,9 +19,11 @@ def parse_diff(diff): if __name__ == "__main__": diff = sys.stdin.read() new_packages = parse_diff(diff) + if new_packages: toot_content = "New packages in the community-archive:\n" toot_content += "\n".join(new_packages) toot_content += "\ngithub.com/poseidon-framework/community-archive #aDNA #OpenData" print(toot_content) - + else: + print("No new package information has been found in this PR")