fix: reconcile Gitea Ralph status labels
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
"number": 5,
|
||||
"url": "https://git.d-popov.com/popov/neuron-tai/issues/5",
|
||||
"state": "open",
|
||||
"status": "in-progress"
|
||||
"status": "ready"
|
||||
},
|
||||
"DGR-022": {
|
||||
"number": 6,
|
||||
|
||||
@@ -8,5 +8,9 @@ cd "$ROOT"
|
||||
python3 scripts/ralph_gitea_sync.py sync
|
||||
ralph_status=0
|
||||
"$@" || ralph_status=$?
|
||||
if [ "$ralph_status" -eq 0 ]; then
|
||||
python3 scripts/ralph_gitea_sync.py sync
|
||||
else
|
||||
python3 scripts/ralph_gitea_sync.py sync --reset-in-progress
|
||||
fi
|
||||
exit "$ralph_status"
|
||||
|
||||
@@ -114,6 +114,7 @@ def main() -> int:
|
||||
parser.add_argument("--feature-dir", type=Path, default=DEFAULT_FEATURE)
|
||||
parser.add_argument("--repo-url", default="https://git.d-popov.com/popov/neuron-tai")
|
||||
parser.add_argument("--dry-run", action="store_true")
|
||||
parser.add_argument("--reset-in-progress", action="store_true", help="Do not claim a next story after a failed Ralph start")
|
||||
args = parser.parse_args()
|
||||
|
||||
feature = args.feature_dir.resolve()
|
||||
@@ -167,7 +168,7 @@ def main() -> int:
|
||||
milestones[title] = {"id": -len(milestones), "title": title}
|
||||
|
||||
passed = {s["id"] for s in stories if s.get("passes")}
|
||||
next_story = next(
|
||||
next_story = None if args.reset_in_progress else next(
|
||||
(
|
||||
s
|
||||
for s in stories
|
||||
@@ -194,6 +195,9 @@ def main() -> int:
|
||||
else:
|
||||
issue = gitea.request("PATCH", f"/issues/{issue['number']}", payload)
|
||||
print(f"reconciled {sid} #{issue.get('number')} {desired_status}")
|
||||
# Gitea's issue PATCH does not reliably replace labels; use the
|
||||
# dedicated endpoint so stale status:in-progress labels are removed.
|
||||
gitea.request("PUT", f"/issues/{issue['number']}/labels", {"labels": label_ids})
|
||||
mapping[sid] = {"number": issue.get("number"), "url": issue.get("html_url"), "state": "closed" if story.get("passes") else "open", "status": desired_status}
|
||||
|
||||
if not args.dry_run:
|
||||
|
||||
Reference in New Issue
Block a user