bd sync: 2026-01-19 21:41:13
Some checks failed
Sync Beads to Gitea Issues / sync-beads (push) Failing after 6s
Some checks failed
Sync Beads to Gitea Issues / sync-beads (push) Failing after 6s
This commit is contained in:
parent
f435bf0b09
commit
071544e2d2
@ -1,4 +1,4 @@
|
|||||||
{"id":"gitea-welcome-0kp","title":"Reverse-sync Test","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:09:52.497127424-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:16.221889237-05:00","comments":[{"id":2,"issue_id":"gitea-welcome-0kp","author":"rootiest","text":"It","created_at":"2026-01-20T02:11:02Z"}],"deleted_at":"2026-01-19T21:22:16.221889237-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
{"id":"gitea-welcome-0kp","title":"Reverse-sync Test","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:09:52.497127424-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:16.221889237-05:00","comments":[{"id":2,"issue_id":"gitea-welcome-0kp","author":"rootiest","text":"It","created_at":"2026-01-20T02:11:02Z"}],"deleted_at":"2026-01-19T21:22:16.221889237-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
||||||
{"id":"gitea-welcome-24k","title":"Reverse-sync Test","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:13:44.940389131-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:05.359383908-05:00","deleted_at":"2026-01-19T21:22:05.359383908-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
{"id":"gitea-welcome-24k","title":"Reverse-sync Test","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:13:44.940389131-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:05.359383908-05:00","deleted_at":"2026-01-19T21:22:05.359383908-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
||||||
{"id":"gitea-welcome-5a4","title":"Test Issue","status":"closed","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T19:24:28.988421899-05:00","created_by":"rootiest","updated_at":"2026-01-19T20:08:24.331722606-05:00","closed_at":"2026-01-19T20:08:24.331722606-05:00","close_reason":"Closed","comments":[{"id":1,"issue_id":"gitea-welcome-5a4","author":"rootiest","text":"Completed!","created_at":"2026-01-20T01:07:50Z"},{"id":3,"issue_id":"gitea-welcome-5a4","author":"rootiest","text":"New","created_at":"2026-01-20T02:29:01Z"}]}
|
{"id":"gitea-welcome-5a4","title":"Test Issue","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T19:24:28.988421899-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:41:09.873551106-05:00","close_reason":"Closed","comments":[{"id":1,"issue_id":"gitea-welcome-5a4","author":"rootiest","text":"Completed!","created_at":"2026-01-20T01:07:50Z"},{"id":3,"issue_id":"gitea-welcome-5a4","author":"rootiest","text":"New","created_at":"2026-01-20T02:29:01Z"}],"deleted_at":"2026-01-19T21:41:09.873551106-05:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"}
|
||||||
{"id":"gitea-welcome-d6r","title":"Reverse-sync Test #2","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:13:44.746027824-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:10.935659182-05:00","deleted_at":"2026-01-19T21:22:10.935659182-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
{"id":"gitea-welcome-d6r","title":"Reverse-sync Test #2","status":"tombstone","priority":2,"issue_type":"task","owner":"chris@rootiest.com","created_at":"2026-01-19T21:13:44.746027824-05:00","created_by":"rootiest","updated_at":"2026-01-19T21:22:10.935659182-05:00","deleted_at":"2026-01-19T21:22:10.935659182-05:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"}
|
||||||
|
|||||||
@ -4,11 +4,12 @@ import requests
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Configuration from Environment
|
# Configuration from Environment
|
||||||
TOKEN = os.getenv("GITEA_TOKEN")
|
TOKEN = os.getenv("MASTER_TOKEN")
|
||||||
URL = os.getenv("GITEA_URL")
|
URL = os.getenv("GITEA_URL")
|
||||||
REPO = os.getenv("REPO_NAME")
|
REPO = os.getenv("REPO_NAME")
|
||||||
HEADERS = {"Authorization": f"token {TOKEN}", "Content-Type": "application/json"}
|
HEADERS = {"Authorization": f"token {TOKEN}", "Content-Type": "application/json"}
|
||||||
|
|
||||||
|
|
||||||
def sync():
|
def sync():
|
||||||
beads_path = ".beads/issues.jsonl"
|
beads_path = ".beads/issues.jsonl"
|
||||||
|
|
||||||
@ -57,9 +58,14 @@ def sync():
|
|||||||
# --- DELETION / TOMBSTONE LOGIC ---
|
# --- DELETION / TOMBSTONE LOGIC ---
|
||||||
if status == "tombstone":
|
if status == "tombstone":
|
||||||
if bid in existing:
|
if bid in existing:
|
||||||
issue_num = existing[bid]['number']
|
issue_num = existing[bid]["number"]
|
||||||
print(f"🗑️ Deleting Gitea Issue #{issue_num} (Tombstone found for {bid})")
|
print(
|
||||||
del_resp = requests.delete(f"{URL}/api/v1/repos/{REPO}/issues/{issue_num}", headers=HEADERS)
|
f"🗑️ Deleting Gitea Issue #{issue_num} (Tombstone found for {bid})"
|
||||||
|
)
|
||||||
|
del_resp = requests.delete(
|
||||||
|
f"{URL}/api/v1/repos/{REPO}/issues/{issue_num}",
|
||||||
|
headers=HEADERS,
|
||||||
|
)
|
||||||
if del_resp.status_code == 204:
|
if del_resp.status_code == 204:
|
||||||
print(f"✅ Successfully deleted {bid}")
|
print(f"✅ Successfully deleted {bid}")
|
||||||
deleted_count += 1
|
deleted_count += 1
|
||||||
@ -72,8 +78,10 @@ def sync():
|
|||||||
|
|
||||||
# --- STANDARD SYNC LOGIC ---
|
# --- STANDARD SYNC LOGIC ---
|
||||||
processed_count += 1
|
processed_count += 1
|
||||||
gitea_state = "closed" if status in ["closed", "done", "finished"] else "open"
|
gitea_state = (
|
||||||
|
"closed" if status in ["closed", "done", "finished"] else "open"
|
||||||
|
)
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"title": f"[{bid}] {title}",
|
"title": f"[{bid}] {title}",
|
||||||
"body": f"{data.get('description', 'No description provided.')}\n\n---\n**Beads ID:** `{bid}`\n**Type:** `{itype}`",
|
"body": f"{data.get('description', 'No description provided.')}\n\n---\n**Beads ID:** `{bid}`\n**Type:** `{itype}`",
|
||||||
@ -99,12 +107,15 @@ def sync():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"⚠️ Error processing bead line: {e}")
|
print(f"⚠️ Error processing bead line: {e}")
|
||||||
|
|
||||||
print(f"🏁 Finished. Active: {processed_count}, Deleted: {deleted_count}, Skipped: {skipped_count}")
|
print(
|
||||||
|
f"🏁 Finished. Active: {processed_count}, Deleted: {deleted_count}, Skipped: {skipped_count}"
|
||||||
|
)
|
||||||
|
|
||||||
# Safety check to ensure we didn't process a completely empty file
|
# Safety check to ensure we didn't process a completely empty file
|
||||||
if (processed_count + deleted_count + skipped_count) == 0:
|
if (processed_count + deleted_count + skipped_count) == 0:
|
||||||
print("❌ ERROR: File was found but it was EMPTY.")
|
print("❌ ERROR: File was found but it was EMPTY.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sync()
|
sync()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user