Documentation
¶
Index ¶
- func BuildUpdatedBody(oldBody, newBody string, cfg Config) string
- func FindMarkedComment(comments []forge.IssueComment, marker, botUser string) *forge.IssueComment
- func Post(ctx context.Context, client forge.Client, owner, repo string, number int, ...) (string, error)
- func TruncateBody(body string, maxSize int) string
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildUpdatedBody ¶
BuildUpdatedBody collapses the old comment body into a flat list of <details> blocks and prepends the new body. Footer content (delimited by FooterMarker) is stripped before collapsing and re-appended after.
func FindMarkedComment ¶
func FindMarkedComment(comments []forge.IssueComment, marker, botUser string) *forge.IssueComment
FindMarkedComment returns the first comment whose body contains the given marker string, or nil if none is found. When botUser is non-empty, only comments authored by that user are considered. This prevents untrusted users from spoofing the marker in their own comments.
func Post ¶
func Post(ctx context.Context, client forge.Client, owner, repo string, number int, body string, cfg Config, printer *ui.Printer) (string, error)
Post implements the sticky comment lifecycle: find an existing comment bearing the marker, collapse old content into history, and create or update in-place. Returns the HTML URL of the comment (empty on dry run).
func TruncateBody ¶
TruncateBody trims body to fit within maxSize, keeping the current content at the top and trimming history from the end. The truncation point is aligned to a valid UTF-8 boundary.