Reply-body temporary files may remain after a failed or interrupted post
Source references: 4The workflow writes the reply and JSON payload to temporary files, but performs an ordinary `rm -f` only after the GitHub command. There is no exit trap or failure-path cleanup, so an error, agent termination, or interrupted process can bypass deletion.
An unpublished reply, quoted review material, or user-supplied rationale may remain in the local temporary directory, subject to that machine's temporary-file permissions and cleanup policy.
The active workflow writes the reply and JSON payload to temporary files, with deletion only after the network-posting command. If execution is interrupted before deletion, the reply could remain in the system temporary directory and may contain non-public review details. The shown procedure has no exit trap or equivalent guaranteed cleanup. A user can ask for guaranteed cleanup and restricted temporary-file permissions and retention.
For review comments, post replies with the REST API endpoint. Write the reply body to a temporary JSON file and pass it with `--input` instead of putting the response text directly in command-line arguments:```shREPLY_BODY_FILE="$(mktemp)"cat > "$REPLY_BODY_FILE"REPLY_PAYLOAD_FILE="$(mktemp)"python3 - "$REPLY_BODY_FILE" "$REPLY_PAYLOAD_FILE" <<'PY'import jsonimport sysfrom pathlib import Pathbody_file = Path(sys.argv[1])payload_file = Path(sys.argv[2])payload_file.write_text(json.dumps({"body": body_file.read_text()}))PYGH_PAGER="" gh api \ --method POST \ /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \ --input "$REPLY_PAYLOAD_FILE"rm -f "$REPLY_BODY_FILE" "$REPLY_PAYLOAD_FILE"```Show 3 other places
For PR-level comments or review-body comments that cannot be directly threaded, post a normal PR comment and quote or link to the original comment:```shREPLY_BODY_FILE="$(mktemp)"cat > "$REPLY_BODY_FILE"GH_PAGER="" gh pr comment {pull_number} --body-file "$REPLY_BODY_FILE"rm -f "$REPLY_BODY_FILE"``````shREPLY_BODY_FILE="$(mktemp)"cat > "$REPLY_BODY_FILE"REPLY_PAYLOAD_FILE="$(mktemp)"python3 - "$REPLY_BODY_FILE" "$REPLY_PAYLOAD_FILE" <<'PY'import jsonimport sysfrom pathlib import Pathbody_file = Path(sys.argv[1])payload_file = Path(sys.argv[2])payload_file.write_text(json.dumps({"body": body_file.read_text()}))PYGH_PAGER="" gh api \ --method POST \ /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \ --input "$REPLY_PAYLOAD_FILE"rm -f "$REPLY_BODY_FILE" "$REPLY_PAYLOAD_FILE"``````shREPLY_BODY_FILE="$(mktemp)"cat > "$REPLY_BODY_FILE"GH_PAGER="" gh pr comment {pull_number} --body-file "$REPLY_BODY_FILE"rm -f "$REPLY_BODY_FILE"```