NewsCrawler.org

gh api -f body=@file: a temp file path ended up in the PR comments

gh api -f body=@file で、PR に一時ファイルのパスが載った
Image: zenn.dev

A developer had Claude Code[1] write follow-up comments for three pull requests, passing each long body from a temporary file as gh api -f body=@file. The -f (--raw-field) option sends the value as a plain string and never reads a file, so all four comments went out with the temporary file's path instead of the intended text, each returning a URL and an exit code[2] of 0. The mistake surfaced one to two days later, when a new Claude Code session that took over the work read the comments back with gh api and found all four errors. Against a local fake API, the author confirmed that -f sends the literal string with exit code 0 even for a nonexistent file, while -F reads the file's contents and stops before sending if the file is missing; an open issue (cli/cli#14199) asks for a warning when a -f value names an existing file. Because GitHub's comment edit history preserves the original body, the four comments were deleted and reposted as three (two on the same pull request were merged into one) after human approval, with success declared only after reading each new body back and matching it against the intended text once CRLF[3] line endings were normalized.

Read the original zenn.dev

Sources

  • Zenn JA

    gh api -f body=@file で、PR に一時ファイルのパスが載った

    2 likes1 bookmark0 comments

Published: First seen: Читать по-русски

Open as a page