feat(repo): add and remove one topic without replacing the whole list #813
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#813
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
madtea repo topics setandmadt_repos action=topics_setreplace the full topic list. There is no way to add or remove one topic. To add a single topic, a caller must read the current list, merge it by hand, and send the whole list back. A stale read, a typo, or a skipped read drops topics, and nothing warns.Today I added one topic to about 40 of my repos. Each one took a read and a full rewrite of its list.
The forge already has the operation:
PUT /repos/{owner}/{repo}/topics/{topic}adds one topic, andDELETEon the same path removes one (docs/api-specs/forgejo-15.0.json,repoAddTopic).Proposal
Follow
gh repo edit --add-topicand--remove-topic:madtea repo edit --add-topic <topic>and--remove-topic <topic>, each repeatable.madt_repos action=edittakesadd_topicsandremove_topics, the same incremental shape asadd_labelsandremove_labelsonmadt_issues action=edit.topics setstays for the case where the caller wants to replace the whole list.Acceptance criteria
repo edit --add-topic xon a repo with topicsa bleavesa b x.repo edit --remove-topic aleavesb x.add_topicsandremove_topicsgive the same results.Related: #723 (a typed read of description and topics).
Closed as resolved. The append-only topic add shipped in PR #816:
repo edit --add-topicandadd_topicsonmadt_repos action=editappend through the per-topic endpoint, andrepo topics set/topics_setnow refuses a set that would drop a topic. The per-topic remove half of this issue is intentionally not implemented: topics are append-only, recorded in ADR 0057. The full-list replace stays reachable only through the raw API passthrough.