Files
claude-code-action/.github/workflows/test-claude-env.yml
Ashwin Bhat 8335bda243 feat: integrate claude-code-base-action as local subaction (#285)
* feat: integrate claude-code-base-action as local subaction

- Copy claude-code-base-action into base-action/ directory
- Update action.yml to reference ./base-action instead of external repo
- Preserve complete base action structure for future refactoring

This eliminates the external dependency while maintaining modularity.

* feat: consolidate CI workflows and add version bump workflow

- Move base-action test workflows to main .github/workflows/
- Update workflow references to use ./base-action
- Add CI jobs for base-action (test, typecheck, prettier)
- Add bump-claude-code-version workflow for base-action
- Remove redundant .github directory from base-action

This consolidates all CI workflows in one place while maintaining
full test coverage for both the main action and base-action.

* tsc

* copy again

* fix tests

* fix: use absolute path for base-action reference

Replace relative path ./base-action with ${{ github.action_path }}/base-action
to ensure the action works correctly when used in other repositories.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: inline base-action execution to support usage in other repos

Replace uses: ./base-action with direct shell execution since GitHub Actions
doesn't support dynamic paths in composite actions. This ensures the action
works correctly when used in other repositories.

Changes:
- Install Claude Code globally before execution
- Run base-action's index.ts directly with bun
- Pass all required INPUT_* environment variables
- Maintain base-action for future separate publishing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-18 13:52:56 -07:00

48 lines
1.4 KiB
YAML

name: Test Claude Env Feature
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test-claude-env-with-comments:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Test with comments in env
id: comment-test
uses: ./base-action
with:
prompt: |
Use the Bash tool to run: echo "VAR1: $VAR1" && echo "VAR2: $VAR2"
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_env: |
# This is a comment
VAR1: value1
# Another comment
VAR2: value2
# Empty lines above should be ignored
allowed_tools: "Bash(echo:*)"
timeout_minutes: "2"
- name: Verify comment handling
run: |
OUTPUT_FILE="${{ steps.comment-test.outputs.execution_file }}"
if [ "${{ steps.comment-test.outputs.conclusion }}" = "success" ]; then
echo "✅ Comments in claude_env handled correctly"
if grep -q "value1" "$OUTPUT_FILE" && grep -q "value2" "$OUTPUT_FILE"; then
echo "✅ Environment variables set correctly despite comments"
else
echo "❌ Environment variables not found"
exit 1
fi
else
echo "❌ Failed with comments in claude_env"
exit 1
fi