Fix 7: Report attachment upload failures in ClickUp comment
When upload_attachment() returns False, the ClickUp comment now includes a warning listing which files failed to upload and their local paths, so Bryan can retrieve them manually. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>fix/customer-field-migration
parent
8c82ccf2de
commit
1eb7df6143
|
|
@ -684,18 +684,27 @@ def write_press_releases(
|
||||||
|
|
||||||
# ── ClickUp: upload docx attachments + comment ─────────────────────
|
# ── ClickUp: upload docx attachments + comment ─────────────────────
|
||||||
uploaded_count = 0
|
uploaded_count = 0
|
||||||
|
failed_uploads: list[str] = []
|
||||||
if clickup_task_id and cu_client:
|
if clickup_task_id and cu_client:
|
||||||
try:
|
try:
|
||||||
for path in docx_files:
|
for path in docx_files:
|
||||||
if cu_client.upload_attachment(clickup_task_id, path):
|
if cu_client.upload_attachment(clickup_task_id, path):
|
||||||
uploaded_count += 1
|
uploaded_count += 1
|
||||||
else:
|
else:
|
||||||
|
failed_uploads.append(path)
|
||||||
log.warning("ClickUp: failed to upload %s for task %s", path, clickup_task_id)
|
log.warning("ClickUp: failed to upload %s for task %s", path, clickup_task_id)
|
||||||
|
upload_warning = ""
|
||||||
|
if failed_uploads:
|
||||||
|
paths_list = "\n".join(f" - {p}" for p in failed_uploads)
|
||||||
|
upload_warning = (
|
||||||
|
f"\n⚠️ Warning: {len(failed_uploads)} attachment(s) failed to upload. "
|
||||||
|
f"Files saved locally at:\n{paths_list}"
|
||||||
|
)
|
||||||
cu_client.add_comment(
|
cu_client.add_comment(
|
||||||
clickup_task_id,
|
clickup_task_id,
|
||||||
f"📎 Saved {len(docx_files)} press release(s). "
|
f"📎 Saved {len(docx_files)} press release(s). "
|
||||||
f"{uploaded_count} file(s) attached.\n"
|
f"{uploaded_count} file(s) attached.\n"
|
||||||
f"Generating JSON-LD schemas next...",
|
f"Generating JSON-LD schemas next...{upload_warning}",
|
||||||
)
|
)
|
||||||
log.info(
|
log.info(
|
||||||
"ClickUp: uploaded %d attachments for task %s", uploaded_count, clickup_task_id
|
"ClickUp: uploaded %d attachments for task %s", uploaded_count, clickup_task_id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue