diff --git a/base-action/README.md b/base-action/README.md index 0889fa160..9ede1088c 100644 --- a/base-action/README.md +++ b/base-action/README.md @@ -113,10 +113,12 @@ Add the following to your workflow file: ## Outputs -| Output | Description | -| ---------------- | ---------------------------------------------------------- | -| `conclusion` | Execution status of Claude Code ('success' or 'failure') | -| `execution_file` | Path to the JSON file containing Claude Code execution log | +| Output | Description | +| ------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `conclusion` | Execution status of Claude Code ('success' or 'failure') | +| `execution_file` | Path to the JSON file containing Claude Code execution log | +| `structured_output` | JSON string containing all structured output fields when `--json-schema` is provided in `claude_args` | +| `session_id` | The Claude Code session ID that can be used with `--resume` to continue the conversation in subsequent workflow steps | ## Environment Variables diff --git a/docs/custom-automations.md b/docs/custom-automations.md index fabb52ff0..968a0cc28 100644 --- a/docs/custom-automations.md +++ b/docs/custom-automations.md @@ -120,3 +120,53 @@ For more control over Claude's behavior, use the `claude_args` input to pass CLI ``` This provides full access to Claude Code CLI capabilities while maintaining the simplified action interface. + +## Conversation Resumption + +The action outputs a `session_id` that allows you to resume Claude conversations across multiple workflow steps. This enables powerful multi-step workflows where you can run intermediate GitHub Actions steps and then continue the same Claude conversation with full context preserved. + +### Multi-Step Analysis Workflow + +```yaml +steps: + # Step 1: Initial Claude analysis + - uses: actions/checkout@v4 + + - uses: anthropics/claude-code-action@v1 + id: claude-analyze + with: + prompt: "Analyze this codebase and identify what dependencies need to be checked" + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + # Step 2: Run intermediate steps + - uses: actions/checkout@v4 + with: + repository: my-org/shared-dependencies + path: ./deps + + - name: Run dependency analysis + id: deps + run: | + echo "dep_report=$(./deps/analyze.sh)" >> $GITHUB_OUTPUT + + - name: Fetch external API data + run: | + curl -s https://api.example.com/status > status.json + + # Step 3: Resume Claude conversation with new context + - uses: anthropics/claude-code-action@v1 + with: + prompt: | + I've gathered the dependency report: ${{ steps.deps.outputs.dep_report }}. + I also fetched the API status (see status.json). + Please continue your analysis with this new information. + claude_args: "--resume ${{ steps.claude-analyze.outputs.session_id }}" + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} +``` + +### Use Cases for Conversation Resumption + +- **Multi-repo analysis**: Check out additional repositories and let Claude analyze them in context +- **External data integration**: Fetch data from APIs, databases, or other services mid-conversation +- **Staged execution**: Run tests or builds between Claude interactions +- **Human-in-the-loop**: Allow manual approval steps before continuing automation