Upload PR images with an issue-scoped token #103

Merged
crowmaki merged 1 commit from tools/pr-images-issue-scope into main 2026-10-08 21:55:21 +00:00
Owner

Follow-up to #102.

scripts/pr-images.mjs read and edited the PR body through /repos/{repo}/pulls/{n}. That endpoint needs the read:repository scope. A token with only the issue scope, which is what docs/agents/issue-tracker.md asks for, failed with a 403. Forgejo's /repos/{repo}/issues/{n} endpoints also work on PRs, so the script now uses them to read and update the body. The attachment upload was already on the issue endpoint.

Tests

  • bun test scripts passes.
  • Ran the fixed script against the real Forgejo on #101 with an issue-only token. It uploaded the four screenshots and linked them in the PR body, and each attachment URL returns 200 image/png.
Follow-up to #102. `scripts/pr-images.mjs` read and edited the PR body through `/repos/{repo}/pulls/{n}`. That endpoint needs the `read:repository` scope. A token with only the issue scope, which is what `docs/agents/issue-tracker.md` asks for, failed with a 403. Forgejo's `/repos/{repo}/issues/{n}` endpoints also work on PRs, so the script now uses them to read and update the body. The attachment upload was already on the issue endpoint. ## Tests - `bun test scripts` passes. - Ran the fixed script against the real Forgejo on #101 with an issue-only token. It uploaded the four screenshots and linked them in the PR body, and each attachment URL returns 200 `image/png`.
The pulls endpoints need the repository scope; the issue endpoints serve
PRs too and need only the issue scope the docs ask for.
crowmaki deleted branch tools/pr-images-issue-scope 2026-10-08 21:55:21 +00:00
Sign in to join this conversation.
No description provided.