Token导航 LogoToken导航TokenDH.com
图像处理操作浏览器github未标认证来源可访问许可证需确认审计提醒

github-upload-image-to-prGitHub upload 图像 TO PR

Agent Skill

用于围绕 GitHub 仓库、Issue、Pull Request、分支、提交和代码协作流程提供辅助能力。它适合让 Agent 查询项目状态、整理变更、辅助创建或检查协作事项,并把仓库中的信息转成可执行的下一步。使用时需要区分只读查询和写入操作;涉及创建 PR、修改 Issue、推送分支或访问私有仓库时,应确认 token 权限、目标仓库范围和用户授权。

总安装

1,503

周安装

62

GitHub Stars

22

下载量

491
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:github-upload-image-to-pr(GitHub upload 图像 TO PR)
来源仓库:https://github.com/tonkotsuboy/github-upload-image-to-pr
仓库路径:skills/github-upload-image-to-pr
安装命令:
npx skills add https://github.com/tonkotsuboy/github-upload-image-to-pr --skill github-upload-image-to-pr
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/tonkotsuboy/github-upload-image-to-pr --skill github-upload-image-to-pr

简介

将本地图片自动上传至 GitHub PR 并插入 Markdown 引用链接。

  • 适用于文档更新、截图补充或可视化说明添加等场景。
  • 支持拖拽上传与格式校验,确保图像合规且加载正常。
  • 需配置 Gist 或仓库写入权限,否则无法完成上传动作。
  • github-upload-image-to-pr 属于图像处理类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Upload Image to PR

Upload local images to a GitHub PR and embed them in the description or comments using browser automation tools.

How It Works

Since the GitHub API does not support direct image uploads, this skill uses the PR comment textarea as a staging area for GitHub's image hosting — uploading files there to obtain persistent user-attachments/assets/ URLs, then updating the PR description or posting a comment via the gh CLI.

Step 0: Resolve PR context

If the user didn't specify a PR number or URL, auto-detect it:

# Get PR number from the current branch
gh pr view --json number,url -q '"\(.number) \(.url)"'

If multiple repos or branches are involved, confirm with the user which PR to target.

Also, normalize the image paths to absolute paths. If a path contains special characters (e.g., Unicode narrow spaces from CleanShot X), copy the file to /tmp/ first:

# e.g., to handle glob-matched paths with special chars
cp /path/to/CleanShot*keyword*.png /tmp/screenshot.png

Tool Detection and Selection

Priority Order

  1. Playwright MCP (MCP connection, mcp__playwright__*) — connects to existing browser, login state preserved
  2. Chrome DevTools MCP (MCP connection, mcp__chrome-devtools__*) — connects to existing browser, login state preserved
  3. agent-browser (CLI via Bash — fallback, login state preserved with --profile)

MCP-based tools connect to an already-running browser instance, so GitHub login state is automatically preserved. agent-browser can persist login state using --profile ~/.agent-browser-github.

Detection

# 1. Search for MCP-based browser tools (preferred)
ToolSearch: "browser navigate upload"

# 2. Fall back to agent-browser only if no MCP tools found
Bash: agent-browser --version

Tool Compatibility Matrix

OperationPlaywright MCPChrome DevTools MCPagent-browser (CLI/Bash)
Navigatebrowser_navigatenavigate_pageagent-browser --headed open {url}
Snapshotbrowser_snapshottake_snapshotagent-browser snapshot
Screenshotbrowser_take_screenshottake_screenshotagent-browser screenshot {path}
Clickbrowser_click (ref)click (uid)agent-browser click {ref}
File Uploadbrowser_file_upload (paths)upload_file (uid, filePath)agent-browser upload {ref} {path}
JS Evalbrowser_evaluate (function)evaluate_script (function)agent-browser eval '{js}'
Login StatePreservedPreservedPreserved with --profile

Steps

Step 1: Navigate to PR page and check login state

Navigate to the PR page and immediately take a snapshot to verify login state.

// Playwright MCP
browser_navigate({ url: "https://github.com/{owner}/{repo}/pull/{number}" })

// Chrome DevTools MCP
navigate_page({ url: "https://github.com/{owner}/{repo}/pull/{number}", type: "url" })

// agent-browser (use --profile to persist login state)
agent-browser --headed --profile ~/.agent-browser-github open "https://github.com/{owner}/{repo}/pull/{number}"

If SSO authentication screen appears: Take a snapshot, locate the "Continue" button, and click it.

If NOT logged in (agent-browser only):

  1. Navigate to https://github.com/login
  2. Ask the user to log in manually in the headed browser window.
  3. Wait for user confirmation, then navigate back to the PR page.

Step 2: Locate the file upload input

Take a snapshot/screenshot and scroll to the bottom to find the comment area.

GitHub renders a file upload input in the comment form. Try these selectors in order (GitHub's UI can change — if one fails, try the next):

// Shared JS for MCP-based tools — tries multiple known selectors
() => {
  const selectors = [
    'input[type="file"][id*="comment"]',
    'input[type="file"][id="fc-new_comment_field"]',
    '#new_comment_field',
    'input[type="file"]'
  ];
  for (const sel of selectors) {
    const el = document.querySelector(sel);
    if (el) return { found: true, id: el.id, selector: sel };
  }
  return { found: false };
}

For Chrome DevTools MCP, you can also take a snapshot to find the uid of the file upload element directly.

Step 3: Upload images one by one

Upload each image file using the detected tool. Wait 2–3 seconds between uploads to allow GitHub to process each file.

For multiple images, upload them all to the same comment textarea before extracting URLs — this is more efficient than navigating between uploads.

// Chrome DevTools MCP: upload_file requires the uid of the input element
// Playwright MCP: browser_file_upload takes the element ref and file path(s) array
// agent-browser: agent-browser upload {ref} {absolute_path}

Important: Always use absolute file paths.

Step 4: Retrieve uploaded image URLs

Wait 3–5 seconds after the last upload, then read the textarea value. GitHub injects markdown image syntax like ![description](https://github.com/user-attachments/assets/...) into the textarea:

// Shared JS — tries both known textarea IDs
() => {
  const ta = document.getElementById('new_comment_field')
          || document.querySelector('textarea[id*="comment"]');
  return ta ? ta.value : 'textarea not found';
}
# agent-browser
agent-browser eval 'document.getElementById("new_comment_field")?.value || document.querySelector("textarea[id*=comment]")?.value || "not found"'

The response contains URLs in the format:

![image](https://github.com/user-attachments/assets/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

Extract all image URLs/markdown from the textarea value before clearing it.

Step 5: Clear the textarea (do not submit the comment)

// MCP-based tools
() => {
  const ta = document.getElementById('new_comment_field')
           || document.querySelector('textarea[id*="comment"]');
  if (ta) { ta.value = ""; return "cleared"; }
  return "textarea not found";
}
# agent-browser
agent-browser eval 'const ta = document.getElementById("new_comment_field") || document.querySelector("textarea[id*=comment]"); if(ta){ta.value=""} "cleared"'

Step 6: Embed images in the PR

Option A — Update PR description (append images to existing body):

EXISTING_BODY=$(gh pr view {PR_NUMBER} --json body -q .body)

gh pr edit {PR_NUMBER} --body "$(printf '%s\n\n## Screenshots\n\n%s' "$EXISTING_BODY" "![screenshot](https://github.com/user-attachments/assets/...)")"

Option B — Post as a new comment:

gh pr comment {PR_NUMBER} --body "## Screenshots

![screenshot](https://github.com/user-attachments/assets/...)"

Use Option A by default unless the user explicitly asks for a comment, or if the PR description is already long and a comment would be cleaner.

Step 7: Verify the result

Reload the page and take a screenshot to confirm the images are displayed correctly.

Tips

  • Image sizing: Control display size via HTML <img> tags: <img width="800" alt="description" src="..." />
  • Multiple images: Upload all images in one session to the same textarea; extract all URLs before clearing
  • Prefer MCP tools: Always prefer Playwright or Chrome DevTools MCP over agent-browser for simpler setup
  • agent-browser login persistence: Use --profile ~/.agent-browser-github to persist GitHub login across sessions

Troubleshooting

IssueSolution
Not logged in (MCP tools)SSO screen may appear — take snapshot, find "Continue" button, click it
Not logged in (agent-browser)Use --headed mode, navigate to login page, ask user to log in manually
Browser window not visibleFor agent-browser, ensure --headed flag is used
File path with special characters (e.g., Unicode narrow spaces from CleanShot)Copy file to /tmp/ with a simple name: cp /path/CleanShot*keyword*.png /tmp/screenshot.png
File upload failsEnsure the file path is absolute
Textarea doesn't contain URLs yetWait 3–5 seconds after upload before running JS eval; retry once if needed
Textarea selector not foundGitHub UI changes occasionally — use the multi-selector JS in Step 2 to find the current element
Chrome DevTools MCP disconnectedReconnect via /mcp command
agent-browser not foundnpm install -g agent-browser && agent-browser install
No browser tools foundUse ToolSearch to search for available browser tools
PR not found / 404Private repos return 404 for unauthenticated users — check login state

Notes

  • GitHub user-attachments/assets/ URLs are persistent — images remain accessible even without submitting the comment
  • Editing the description directly in the browser UI is fragile due to GitHub UI structure changes — updating via gh pr edit is strongly preferred
  • Multiple images can be uploaded in a single session before extracting URLs
  • MCP-based tools connect to existing browser instances, preserving cookies and login sessions

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.35%
按下载量换算159

Claude

29.58%
按下载量换算145

Cursor

19.28%
按下载量换算95

Gemini CLI

9.04%
按下载量换算44

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills