From 18ff77f1b6ef4afec4150bc60559b54a107d33bd Mon Sep 17 00:00:00 2001 From: atani Date: Sat, 18 Apr 2026 23:51:06 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20polish=20README=20=E2=80=94=20url-only?= =?UTF-8?q?=20notes,=20portable=20install=20path,=20dedupe=20config=20sect?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Clarify that step 1 of Browser mode (create placeholder comment) is skipped when --url-only is set. Previously step 1 sounded mandatory and only step 5 mentioned the url-only path. - Replace the manual-install symlink target /usr/local/bin with ~/.local/bin so the snippet works without sudo on Apple Silicon (where /usr/local/bin is not writable by default). - Soften the Direct mode claim — we have not regression-tested it against current github.com, so call it historical/opt-in rather than asserting it works. - Fold the duplicated 'Configuration file' section into the Direct mode section. One authoritative description instead of two. --- README.md | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 0351c5b..ebec65f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,9 @@ brew install gh-attach ```bash npm install -g @playwright/cli # provides the playwright-cli binary git clone https://github.com/atani/gh-attach.git -ln -s "$PWD/gh-attach/bin/gh-attach" /usr/local/bin/gh-attach +# Put the script on your PATH. Adjust the target if ~/.local/bin is not on PATH. +mkdir -p ~/.local/bin +ln -s "$PWD/gh-attach/bin/gh-attach" ~/.local/bin/gh-attach ``` ## Requirements @@ -135,40 +137,34 @@ If no placeholder is present, images are appended to the end of the body. ### Browser mode (default; required for GHE) -1. Create a comment with placeholders +1. Create a comment with placeholders (skipped when `--url-only`) 2. Open the Issue/PR page via playwright-cli 3. Click the native "Paste, drop, or click to add files" button 4. Upload the image; read the resulting URL from the comment textarea -5. Update the comment with `` tags (or skip if `--url-only`) +5. Either update the placeholder comment with `` tags, or (with + `--url-only`) print the URL to stdout and exit without touching + comments ### Release mode (`--release`) Uploads are stored on a tagged Release in the repo. No browser needed, but the URL format is `releases/download/...` (not `user-attachments/assets/...`). -### Direct mode (auto-enabled for hosts in config) +### Direct mode (opt-in per host) -Faster than Browser mode because the actual upload goes over `curl` after -playwright-cli has obtained the upload policy from the `file-attachment` -custom element. This mode works on **GitHub.com** but not on current GHE -because GHE's React UI does not expose the `file-attachment` element. +Once playwright-cli has the upload policy from the `file-attachment` +custom element, the actual upload goes over `curl` — faster than +scripting the full browser click/upload dance. Direct mode is the +historical github.com path (use at your own discretion; test with +`--browser` available as a fallback). Current GitHub Enterprise does +**not** work in Direct mode because GHE's React UI does not render +the `file-attachment` element. -Enable Direct mode per host: +Enable Direct mode by listing hosts in `~/.config/gh-attach/config`: -``` -# ~/.config/gh-attach/config -direct_hosts=github.com -``` - -## Configuration file - -``` -~/.config/gh-attach/config -``` - -``` +```ini # Direct mode is auto-selected for these hosts. -# Leave empty (or omit) for Browser mode only. +# Leave the list empty or omit the file for Browser mode only. direct_hosts=github.com ```