Script to upload PR images to Forgejo #102
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/ai-studio!102
Loading…
Reference in a new issue
No description provided.
Delete branch "tools/pr-image-uploads"
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?
fjcan't upload attachments, so PRs with UI changes had no way to include screenshots from the CLI. This adds a small script for that. It has no dependencies.What changed
scripts/pr-images.mjs:POST /repos/{repo}/issues/{n}/assets). It then points everylink in the PR body at the uploaded file.## Screenshots, with the file name as alt text. A second run replaces those images instead of appending duplicates.originby default.--hostand--repooverride them.FORGEJO_TOKEN, never fromfj's key store.--dry-runreads the PR and prints the new body without uploading or editing anything.scripts/pr-images.test.mjs: unit tests for parsing remotes and for rewriting links.bun run testnow runssrcandscripts.docs/agents/issue-tracker.md: a new "Images in a pull request" section explains the workflow. It also says the user supplies the token.Usage
Tests
bun run testpasses: 5 tests for the script, and the fullsrcsuite.image/pngpart type, then PATCHes the body with the links replaced.--dry-runagainst #101 finds and would replace all four of its image links.