properly sync closed issues
All checks were successful
Sync Beads to Gitea Issues / sync-beads (push) Successful in 7s
All checks were successful
Sync Beads to Gitea Issues / sync-beads (push) Successful in 7s
This commit is contained in:
parent
39c0aaf630
commit
e210607a1c
@ -35,7 +35,7 @@ def sync():
|
||||
# 2. Parse the Beads JSONL file
|
||||
processed_count = 0
|
||||
skipped_count = 0
|
||||
|
||||
|
||||
with open(beads_path, "r") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
@ -61,17 +61,22 @@ def sync():
|
||||
continue
|
||||
|
||||
processed_count += 1
|
||||
# Normalize the state for Gitea
|
||||
# Beads can use 'closed', 'done', or 'finished'
|
||||
is_closed = status in ["closed", "done", "finished"]
|
||||
gitea_state = "closed" if is_closed else "open"
|
||||
|
||||
unique_title = f"[{bid}] {title}"
|
||||
payload = {
|
||||
"title": unique_title,
|
||||
"body": f"{data.get('description', 'No description provided.')}\n\n---\n**Beads ID:** `{bid}`\n**Type:** `{itype}`",
|
||||
"state": "closed"
|
||||
if status in ["closed", "done"]
|
||||
else "open",
|
||||
"state": gitea_state, # Use the normalized variable here
|
||||
}
|
||||
|
||||
if bid in existing:
|
||||
print(f"✅ Updating Gitea Issue #{existing[bid]['number']} for {bid}")
|
||||
print(
|
||||
f"✅ Updating Gitea Issue #{existing[bid]['number']} for {bid}"
|
||||
)
|
||||
requests.patch(
|
||||
f"{URL}/api/v1/repos/{REPO}/issues/{existing[bid]['number']}",
|
||||
headers=HEADERS,
|
||||
@ -90,7 +95,7 @@ def sync():
|
||||
print(f"⚠️ Error processing bead: {e}")
|
||||
|
||||
print(f"🏁 Finished. Active: {processed_count}, Skipped: {skipped_count}")
|
||||
|
||||
|
||||
# We check if we have ANY beads (active or tombstone) to validate the file isn't broken
|
||||
if (processed_count + skipped_count) == 0:
|
||||
print("❌ ERROR: File was found but it was EMPTY.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user