Skip to content

Feature Request: Expose session_id output for conversation resumption #740

@gor-st

Description

@gor-st

Feature Request: Expose session_id output for conversation resumption

Problem

Currently, when using anthropics/claude-code-action, there's no way to resume a conversation after the action completes. Each invocation starts a fresh session, losing all context from previous interactions.

This is limiting for complex CI/CD workflows where you might want to:

  1. Run Claude Code to analyze something
  2. Perform intermediate steps (checkout repos, run tests, fetch data)
  3. Continue the same Claude conversation with additional context

Use Cases

1. Multi-Repository Analysis

# Analyze main repo, checkout dependencies, then continue analysis
- uses: anthropics/claude-code-action@v1
  id: initial
  with:
    prompt: "Analyze this service and identify its dependencies"

- uses: actions/checkout@v4
  with:
    repository: my-org/shared-libs
    path: ./libs

- uses: anthropics/claude-code-action@v1
  with:
    prompt: "Now analyze the shared libraries and how they integrate"
    claude_args: "--resume ${{ steps.initial.outputs.session_id }}"

2. Staged Code Review with Test Results

# Initial review, run tests, then provide test feedback to Claude
- uses: anthropics/claude-code-action@v1
  id: review
  with:
    prompt: "Review this PR and suggest improvements"

- name: Run test suite
  id: tests
  run: npm test 2>&1 | tee test-output.txt

- uses: anthropics/claude-code-action@v1
  with:
    prompt: "Here are the test results. Update your review based on any failures."
    claude_args: "--resume ${{ steps.review.outputs.session_id }}"

3. Human-in-the-Loop Workflows

# Claude proposes changes, wait for approval, then implement
- uses: anthropics/claude-code-action@v1
  id: proposal
  with:
    prompt: "Propose a refactoring plan for the authentication module"

- uses: trstringer/manual-approval@v1
  with:
    approvers: tech-leads

- uses: anthropics/claude-code-action@v1
  with:
    prompt: "Approval received. Please implement the proposed changes."
    claude_args: "--resume ${{ steps.proposal.outputs.session_id }}"

4. External Data Integration

# Analyze code, fetch production metrics, continue with real data
- uses: anthropics/claude-code-action@v1
  id: analyze
  with:
    prompt: "Identify potential performance bottlenecks in this service"

- name: Fetch production metrics
  run: |
    curl -s "${{ secrets.METRICS_API }}/performance" > metrics.json

- uses: anthropics/claude-code-action@v1
  with:
    prompt: "Here are the actual production metrics. Refine your analysis."
    claude_args: "--resume ${{ steps.analyze.outputs.session_id }}"

Proposed Solution

Expose the session_id from Claude Code's execution output as a GitHub Action output. Claude Code already supports --resume <session_id> for continuing conversations, we just need to surface the session ID from the action.

Implementation

PR #739 implements this feature by:

  • Adding parseAndSetSessionId() function to extract session_id from the execution output
  • Adding session_id as an output in both action.yml and base-action/action.yml
  • Including comprehensive tests

Benefits

  • Context preservation: Claude retains full memory of previous interactions
  • Cost efficiency: No need to re-send context in prompts
  • Complex workflows: Enable multi-step automation with intermediate processing
  • Better results: Claude can build on its previous analysis rather than starting fresh

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestp2Non-showstopper bug or popular feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions