Skip to content

feat: add --session/--keep-session/--url-only options#12

Closed
atani wants to merge 1 commit intomainfrom
feat/session-keep-url-only
Closed

feat: add --session/--keep-session/--url-only options#12
atani wants to merge 1 commit intomainfrom
feat/session-keep-url-only

Conversation

@atani
Copy link
Copy Markdown
Owner

@atani atani commented Apr 18, 2026

Summary

Adds three new options to gh-attach so that it can be used as a drop-in
replacement for bespoke playwright-cli wrappers against GHE (git.pepabo.com)
behind OneLogin SAML:

  • --session <name> — reuse a named playwright-cli session (e.g. a
    persistent ghe session that has already been SAML-authenticated). The
    previous behavior was to always use the unnamed default session, which
    meant session-only cookies and "remember this device" state were not
    shared across invocations.
  • --keep-session — skip playwright-cli session-stop on exit. Keeping
    the browser process alive preserves session-only cookies, dramatically
    reducing the frequency of SAML re-authentication prompts.
  • --url-only — print uploaded asset URLs to stdout (one per line) and
    skip comment creation/update. Lets callers post evidence via their own
    tooling (e.g. gh pr review --comment --body-file) while still using
    gh-attach for the upload step.

Motivation

On GHE behind OneLogin SAML, the existing flow forced a fresh SAML login
many times per day because the browser session was torn down after every
upload. With --session ghe --keep-session, a single morning login keeps
working for the whole day.

Bumps VERSION to 0.7.0.

Test plan

  • gh-attach --help lists the three new options
  • bash -n bin/gh-attach passes syntax check
  • gh-attach --session ghe --keep-session --url-only --issue N --image foo.png --host git.pepabo.com --repo OWNER/REPO uploads without tearing down the session and prints only the URL
  • Existing Browser/Release/Direct modes without the new flags behave unchanged

- --session <name>: reuse a named playwright-cli session (e.g. a persistent
  GHE session with SAML already authenticated). Previously the default
  unnamed session was always used, which meant session-only cookies and
  "remember this device" state was not shared across invocations.
- --keep-session: skip `playwright-cli session-stop` on exit. Keeping the
  browser process alive preserves session-only cookies, which drastically
  reduces the frequency of SSO/SAML re-authentication prompts.
- --url-only: print uploaded asset URLs to stdout and skip comment
  creation/update. Lets callers post evidence via their own tooling
  (e.g. `gh pr review --comment --body-file`) while still using gh-attach
  for the upload step.

Primary motivation: on GHE behind OneLogin SAML, the previous flow forced
a fresh login many times per day because the browser session was torn
down after every upload. With `--session ghe --keep-session`, a single
morning login keeps working for the whole day.

Bumps VERSION to 0.7.0.
@atani
Copy link
Copy Markdown
Owner Author

atani commented Apr 18, 2026

GHE は React 実装のため file-attachment カスタム要素が存在せず Direct mode が使えない。Browser mode の URL extraction も GHE の textarea 構造と非互換。結局 dotfiles 側の wrapper を playwright-cli 直接実行方式に戻したので、このPRの変更は GHE 用途には不要。github.com 用途では有用 (future use) なので、別PRで本家に出す形にする。

@atani atani closed this Apr 18, 2026
@atani atani deleted the feat/session-keep-url-only branch April 18, 2026 14:06
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