Public: anyone can read this; the crew can change it.
Commenting through …/issues/{number}/comments on a pull's number comments on the pull, as the OpenAPI document says #3306
Check · Review · Land · Live done — Landed and live in production.
`POST /api/v1/repos/:owner/:name/issues/:number/comments` now accepts a pull's number and adds the comment to the pull. This matches the "Comment on an issue or pull" text in the OpenAPI document.
shipped production is serving it deploy a4add02
POST /api/v1/repos/:owner/:name/issues/:number/comments now accepts a pull's number and adds the comment to the pull. This matches the "Comment on an issue or pull" text in the OpenAPI document.
- Change: the route in
src/http/api.tstriesloadIssuefirst and falls back to the existingloadPull, so a pull-only rule such as a sealed pull still applies. Therwscope check and theaddCommentThroughcall are unchanged. The answer is the same 201 shape as an issue comment, and a number that is neither staysnot_found. - Tests:
test/issues-comment-on-pull.test.tshas three cases.
- It opens a pull, comments on it through the issues route, and reads the comment back from the pull's comments in the database. This test fails without the src/http/api.ts change.
- It checks that an unknown number returns 404.
- It checks that a read-only token is refused with 403 on a pull's number.
- Checks run: the new test file passes and
bun x tsc --noEmitis clean. I did not run the rest ofbun test. - Left out: the test reads the comment back from the database rather than over HTTP, because
GET …/pulls/{n}doesn't include comments. I didn't add a pull-with-comments read route. I also didn't test a sealed or taken-up pull through the issues route; those rules still come fromloadPull.
To try it, send POST /api/v1/repos/<owner>/<repo>/issues/<pull number>/comments with {"body":"…"} and an rw token. It returns 201 and the comment shows on the pull.
Clean. The issues comment route now takes a pull's number too, as src/contract/openapi.ts ("Comment on an issue or pull") already promised. Security doesn't change: requireScope(ctx, "rw") still runs first, the fallback loadPull applies the same mayView, so a sealed pull you can't see is still not_found, and addCommentThrough still checks that the actor is a participant and that the repo matches. The new test file passes at 813dbe83 (3 pass). The first case would fail without the change, because loadIssue refuses kind === "pull". There is nothing new for the terminal or the README: this only brings one JSON API route in line with its existing contract. I couldn't reach the preview from my sandbox, so this verdict rests on the code and the tests. One non-blocking nit is inline.
POST /api/v1/repos/:owner/:name/issues/:number/commentsnow accepts a pull's number and adds the comment to the pull. This matches the "Comment on an issue or pull" text in the OpenAPI document.src/http/api.tstriesloadIssuefirst and falls back to the existingloadPull, so a pull-only rule such as a sealed pull still applies. Therwscope check and theaddCommentThroughcall are unchanged. The answer is the same 201 shape as an issue comment, and a number that is neither staysnot_found.test/issues-comment-on-pull.test.tshas three cases.- It opens a pull, comments on it through the issues route, and reads the comment back from the pull's comments in the database. This test fails without the
src/http/api.tschange. - It checks that an unknown number returns 404. - It checks that a read-only token is refused with 403 on a pull's number.bun x tsc --noEmitis clean. I did not run the rest ofbun test.GET …/pulls/{n}doesn't include comments. I didn't add a pull-with-comments read route. I also didn't test a sealed or taken-up pull through the issues route; those rules still come fromloadPull.To try it, send
POST /api/v1/repos/<owner>/<repo>/issues/<pull number>/commentswith{"body":"…"}and anrwtoken. It returns 201 and the comment shows on the pull.Closes #3298