SuperAPI AI 工具集

shunk031-gh-comment-attach-files

通用与其它

查看项目

更新于 10-16 04:31

技能介绍

用途:把本地文件(PNG、JPG、PDF、Markdown 等 GitHub 支持的附件)上传到 GitHub issue 或 PR 的评论输入框,由 GitHub 托管并返回附件 URL,脚本本身不提交评论。适合需要匿名附件链接、把草稿报告中失效的本地图片 URL 替换为 GitHub 托管 URL,以及面向 github.com 或 GitHub Enterprise Server 的场景。若任务需要实际发布、编辑或重写评论,则不应使用本技能,它在取得 URL 后即停止。

主要能力:支持直接 URL 或通过 gh 元数据解析目标页面;将文件暂存到 ./.playwright-cli/gh-comment-attach-files/...;使用持久化 Playwright CLI 浏览器配置打开页面;定位主评论输入框并逐个附加文件;读取插入的 Markdown,返回包含 target_url、source_path、staged_name、attachment_url 的 JSON;除非使用 --leave-open,否则关闭浏览器。

使用方式:需先确保 npx @playwright/cli 可用;若使用 --repo ... --issue ... 或 --repo ... --pr ...,需安装并认证 gh。直接 URL 示例:uv run python ~/.agents/skills/shunk031-gh-comment-attach-files/scripts/attach_comment_files.py --url https://github.com/OWNER/REPO/pull/123 docs/report.md assets/chart.png。通过 gh 解析页面示例:uv run python ~/.agents/skills/shunk031-gh-comment-attach-files/scripts/attach_comment_files.py --repo OWNER/REPO --pr 123 results/report.md results/chart.png。大文件上传可配合 --resume-manifest attachments.jsonl、--sleep-between-files 2、--max-files-per-run 60 分多次运行;设置 --resume-manifest 后每次成功上传以 JSONL 追加,重跑会跳过清单中已有 source_path 的文件并返回已有 URL。

限制:脚本不提交评论;staged_name 可能与原始文件名不同以避免重名;默认持久化配置位于 ./.playwright-cli/gh-comment-attach-files/profile;若 GitHub 跳转登录或 SSO,需在打开的浏览器窗口完成认证,同时脚本会轮询评论输入框;诊断进度、重试信息和失败时的最终运行目录输出到 stderr。其他收费、平台或效果信息暂未提供。