Skip to content

Add direct upload mode for configurable hosts#9

Merged
atani merged 1 commit intomainfrom
feature/direct-upload-mode
Feb 10, 2026
Merged

Add direct upload mode for configurable hosts#9
atani merged 1 commit intomainfrom
feature/direct-upload-mode

Conversation

@atani
Copy link
Copy Markdown
Owner

@atani atani commented Feb 10, 2026

Summary

  • 設定ファイル (~/.config/gh-attach/config) で指定したホストに対して、direct upload mode を自動適用
  • file-attachment Web Component 経由で upload policy を取得し、curl でファイルをアップロードするハイブリッド方式
  • user-attachments URL を生成(Release アセットを作らない)
  • --browser フラグで従来の browser mode に強制切り替え可能

動作フロー (Direct mode)

  1. PR/Issue ページに遷移 (playwright-cli)
  2. file-attachment コンポーネントに fake File を渡して upload policy を取得
  3. XHR upload をブロックしてトークンを温存
  4. curl で media server にファイルを POST → user-attachments URL を取得
  5. コメントを更新

Test plan

  • direct_hosts に登録した GHE ホストで direct mode が動作することを確認
  • コメントに user-attachments URL で画像が埋め込まれることを確認
  • Release にアセットが作られないことを確認
  • --browser フラグで browser mode にフォールバックできることを確認
  • --release フラグで release mode が動作することを確認
  • 複数画像のアップロードテスト

file-attachment component + curl hybrid upload produces
user-attachments URLs without release artifacts.

- Add direct mode using upload policies API via browser auth and curl
- Add --browser flag to force browser mode
- Read ~/.config/gh-attach/config for direct_hosts setting
- Update README with direct mode documentation
@atani atani merged commit e020e46 into main Feb 10, 2026
1 check passed
@atani atani deleted the feature/direct-upload-mode branch February 10, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant