docs(agent): a PR comment posts to the issues endpoint, and an empty jq body is silent
Measured while commenting on PR 102: POST /pulls/102/comments answers 405 to a plain body (it is the review-comment store); the conversation thread is POST /issues/<PR-number>/comments, which answers 201 and returns an html_url on the PR. Gitea maintains one issue index, so the PR number is the same number. The trap that hid it: building the body with jq --rawfile b /dev/stdin inside a command substitution feeds jq nothing (the substitution does not inherit the heredoc), Gitea answers 422, and jq -r .id on the error prints nothing — a silent no-op that looked like a posted comment. The body goes in a file.
This commit is contained in:
1 parent
e531e90278
commit
0a365274b6
1 file changed
+8
@@ -48,6 +48,14 @@ Use the `Authorization: token` header for everything.
|
|||||||
- **Read an issue**: `curl -s -K "$cfg" $API/issues/<number>` (fields: `number`, `title`, `body`, `labels[].name`, `state`)
|
- **Read an issue**: `curl -s -K "$cfg" $API/issues/<number>` (fields: `number`, `title`, `body`, `labels[].name`, `state`)
|
||||||
- **List issues**: `curl -s -K "$cfg" "$API/issues?state=open&limit=50"` — add `&labels=<id>` to filter
|
- **List issues**: `curl -s -K "$cfg" "$API/issues?state=open&limit=50"` — add `&labels=<id>` to filter
|
||||||
- **Comment**: `curl -s -K "$cfg" -X POST -d "$(jq -n --rawfile b "$BODY" '{body:$b}')" $API/issues/<number>/comments`
|
- **Comment**: `curl -s -K "$cfg" -X POST -d "$(jq -n --rawfile b "$BODY" '{body:$b}')" $API/issues/<number>/comments`
|
||||||
|
- **Comment on a PR**: the conversation thread is `POST $API/issues/<PR-number>/comments`
|
||||||
|
(201, and the answer's `html_url` points at `pulls/<n>`; Gitea's issue index is
|
||||||
|
unified, so the PR's number is the same number). `$API/pulls/<n>/comments` is the
|
||||||
|
**review**-comment store and answers `405` to a plain body.
|
||||||
|
- **A body built by `jq --rawfile b /dev/stdin` inside `$(…)` is empty**: the command
|
||||||
|
substitution does not inherit the heredoc, so Gitea receives `{}` and answers 422 —
|
||||||
|
and `jq -r '.id'` on the error prints nothing, which reads as success. Write the
|
||||||
|
body to a file and pass `--rawfile` that file.
|
||||||
- **Apply labels**: `POST $API/issues/<number>/labels` with `{"labels":[<label-ID numbers>]}` — Gitea wants numeric label **IDs**, not names; resolve them from `GET $API/labels` (see [[Triage Labels]] for which labels exist)
|
- **Apply labels**: `POST $API/issues/<number>/labels` with `{"labels":[<label-ID numbers>]}` — Gitea wants numeric label **IDs**, not names; resolve them from `GET $API/labels` (see [[Triage Labels]] for which labels exist)
|
||||||
- **Remove a label**: `DELETE $API/issues/<number>/labels/<label-id>`
|
- **Remove a label**: `DELETE $API/issues/<number>/labels/<label-id>`
|
||||||
- **Close**: `PATCH $API/issues/<number>` with `{"state":"closed"}`
|
- **Close**: `PATCH $API/issues/<number>` with `{"state":"closed"}`
|
||||||
|
|||||||
Reference in new issue
Block a user