AGENT SKILL

gh-comment-attach-files

Attach local files to a GitHub issue or pull request comment via Playwright CLI and return the hosted attachment URLs without submitting the comment. Use when you need GitHub-hosted image or document URLs on github.com or GitHub Enterprise Server.

License 许可
MIT
所属仓库
mryfmo/dotfiles
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
gh-comment-attach-files
description
Attach local files to a GitHub issue or pull request comment via Playwright CLI and return the hosted attachment URLs without submitting the comment. Use when you need GitHub-hosted image or document URLs on github.com or GitHub Enterprise Server.

02 资源文件 2

03 SKILL.md 正文

GitHub Comment Attach Files

Read Acknowledgement

  • After reading this skill, say: 🐙 私は gh-comment-attach-files を読みました。

When To Use

Use this skill when you need GitHub to host local files and give back anonymized attachment URLs, but the agent must not submit the issue or pull request comment itself.

Typical cases:

  • Upload PNG, JPG, PDF, Markdown, or other GitHub-supported attachments to a PR or issue comment box.
  • Replace broken local image URLs in a draft report with GitHub-hosted URLs.
  • Work against either github.com or GitHub Enterprise Server.

Do not use this skill when the task is to actually post, edit, or rewrite a comment. This skill stops after URL acquisition.

Prerequisites

  • npx @playwright/cli must be available.
  • If you use --repo ... --issue ... or --repo ... --pr ..., gh must be installed and authenticated.
  • If GitHub redirects to login or SSO, finish authentication in the opened browser window while the script is polling for the comment composer.

Workflow

  1. Resolve the target page from either a direct URL or gh metadata.
  2. Stage the requested files under ./.playwright-cli/gh-comment-attach-files/....
  3. Open the issue or pull request page with a persistent Playwright CLI browser profile.
  4. Find the main comment composer and attach files one by one.
  5. Read the inserted Markdown and return JSON with target_url, source_path, staged_name, and attachment_url.
  6. Close the browser unless --leave-open is used.

Command

Run the command from the project directory so file arguments and ./.playwright-cli/ resolve there; the script is called by its installed path.

Direct URL:

uv run --no-project ~/.agents/skills/gh-comment-attach-files/scripts/attach_comment_files.py \
  --url https://github.com/OWNER/REPO/pull/123 \
  docs/report.md assets/chart.png

Resolve the page with gh:

uv run --no-project ~/.agents/skills/gh-comment-attach-files/scripts/attach_comment_files.py \
  --repo github.example.com/OWNER/REPO \
  --pr 123 \
  results/report.md results/chart.png

Output

The script prints JSON only:

{
  "target_url": "https://github.com/OWNER/REPO/pull/123",
  "attachments": [
    {
      "source_path": "/abs/path/results/chart.png",
      "staged_name": "chart--e5b6d4a1.png",
      "attachment_url": "https://github.com/user-attachments/assets/..."
    }
  ]
}

Notes

  • The script does not submit the comment.
  • staged_name may differ from the original basename so duplicate filenames stay distinct.
  • The default persistent profile lives under ./.playwright-cli/gh-comment-attach-files/profile.
  • Use --leave-open when you want to keep the browser and draft comment visible after the URLs are collected.

Resources

scripts/

  • scripts/attach_comment_files.py: resolves the target page, stages files, drives Playwright CLI, and returns hosted attachment URLs as JSON.

04 同仓库更多 Skills