Spaces:
Build error
Build error
Update app.py
Browse files24 unmodified lines252627282829303132333436 unmodified lines71727374757677787980818292 unmodified lines1751761771781791801811821836 unmodified lines19019119218119319419519619724 unmodified lines# dictionary that collects tags that can be added to commit messages.# key -> column name in notion # value -> possible valuestag_dict = {"status_tag":["WIP", "ReviewNeeded", "Final"]}tag_dict = {"status-message":["WIP", "ReviewNeeded", "Final"]}
# tag part seperator -> #+ , other_tags
36 unmodified lines branch_data["commit_url"] = f"{server_url}streams/{stream_id}/commits/{latest_commit.id}" branch_data["commit_message"] = latest_commit.message branch_data["author"] = latest_commit.authorName # Check if the commit message contains '#+' and then extract tags if '#+' in latest_commit.message: tags_part = latest_commit.message.split("#+")[1] branch_data["status-message"] = [tg for tg in tag_dict["status-message"] if tg in tags_part] else: branch_data["status-message"] = [] #except Exception as e: # print(f"Error fetching commits for branch {branch.name}: {str(e)}")
92 unmodified lines updated_isoformat = updated_value.isoformat() else: updated_isoformat = datetime.datetime.now().isoformat() # Use datetime.datetime.now() here # Prepare status-message tags for multi-select status_messages = branch.get("status-message", []) status_message_data = [{"name": sm} for sm in status_messages]
page_data = { "properties": {6 unmodified lines "sub-variant": {"rich_text": [{"text": {"content": branch.get("sub-variant", "")}}]}, "author": {"rich_text": [{"text": {"content": branch.get("author", "")}}]}, "commit_message": {"rich_text": [{"text": {"content": branch.get("commit_message", "")}}]}, "depends-on": {"multi_select": [{"name": d} for d in existing_depends_on]} "depends-on": {"multi_select": [{"name": d} for d in existing_depends_on]}, "status-message": {"multi_select": status_message_data} } }
app.py+15-2