google-github-actions / google-github-actions/run-gemini-cli

Add file-based output mode to avoid exceeding GitHub Actions output limits with debug enabled

Open
#479 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/configuration area/github-action github_actions kind/enhancement
Dominant language
TypeScript
Stars
2.1k
Forks
285
Avg merge
8h 8m
Merged PRs (30d)
1

Description

TL;DR

When gemini_debug is enabled, the action streams all debug output to the console via tee and writes the full content to GITHUB_OUTPUT. Recent versions of Gemini CLI (post-0.25.x) significantly increased the volume of diagnostic output behind the --debug flag (auth info, API request/error counts, retry events, loop detection). This causes GITHUB_OUTPUT to exceed the ~1MB platform limit, resulting in truncated or failed step outputs.

Proposal

Add a new output_to_file boolean input (default: false) that, when enabled:

  1. Redirects all output to files only — runs with --debug but without tee to the console, same as non-debug redirection but with the --debug flag
  2. Returns file paths as step outputssummary contains the path to gemini-artifacts/stdout.log and error contains the path to gemini-artifacts/stderr.log, instead of the file contents
  3. Produces a compact job summary — instead of dumping the full response/error into the step summary, shows file sizes and paths
  4. Adds new outputsoutput_mode (content or file) and artifacts_dir (path to gemini-artifacts/) so callers can programmatically detect the mode

When output_to_file is not set (or false), behavior is identical to today — full backwards compatibility.

Why file-based output?
  • The gemini-artifacts/ directory already exists and is populated with stdout.log, stderr.log, and telemetry.log on every run
  • Callers can upload these as artifacts (via upload_artifacts: true), filter/process them in subsequent steps, or extract specific data (e.g., stats, traces)
  • This pattern naturally enables future stream-json adoption — once output goes to a file, callers can parse NDJSON to extract both the final response and a step-by-step agent trace
Detailed design

The execution block (lines 294-307) would add a third branch:

if [[ "${GEMINI_DEBUG}" = true ]] && [[ "${OUTPUT_TO_FILE}" = true ]]; then
  # Debug to files only — no console streaming
  if ! gemini --debug --yolo --prompt "${PROMPT}" --output-format json \
    2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
    FAILED=true
  fi
elif [[ "${GEMINI_DEBUG}" = true ]]; then
  # Existing behavior: stream to console via tee
  ...
else
  # Existing behavior: silent capture
  ...
fi

The output-setting block (lines 340-356) would conditionally emit paths or content:

if [[ "${OUTPUT_TO_FILE}" = true ]]; then
  echo "gemini_response<<EOF" >> "${GITHUB_OUTPUT}"
  echo "$(pwd)/gemini-artifacts/stdout.log" >> "${GITHUB_OUTPUT}"
  echo "EOF" >> "${GITHUB_OUTPUT}"
else
  # existing content-based output
fi
Related issues
  • #381 — summary output contains invalid JSON due to EOF delimiter handling. File-based output sidesteps this entirely since file paths don't contain EOF.
  • #305 — Refactor scripts into own files. This change adds a small amount of logic to the existing bash block; if the refactor lands first, the change would go into the extracted script instead.
Additional information

I'm happy to submit a PR for this. My use case is a CI code review bot that uses gemini_debug: true with 80+ turn sessions, producing debug output that consistently exceeds GitHub's output limits.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the execution block at lines 294-307 and the output-setting block at lines 340-356, then review how the existing gemini-artifacts files and action inputs are handled. Add the file mode while preserving current behavior by default; done means file paths, output_mode, artifacts_dir, and a compact summary are emitted without exceeding GITHUB_OUTPUT limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, shell
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.