Some checks failed
Test Custom Executables / test-custom-executables (push) Has been cancelled
CI / test (push) Has been cancelled
CI / prettier (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Sync Base Action to claude-code-base-action / Sync base-action to claude-code-base-action repository (push) Has been cancelled
Test Claude Code Action / test-inline-prompt (push) Has been cancelled
Test Claude Code Action / test-prompt-file (push) Has been cancelled
Test Claude Env Feature / test-claude-env-with-comments (push) Has been cancelled
Test MCP Servers / test-mcp-integration (push) Has been cancelled
Test MCP Servers / test-mcp-config-flag (push) Has been cancelled
Test Settings Feature / test-settings-inline-allow (push) Has been cancelled
Test Settings Feature / test-settings-inline-deny (push) Has been cancelled
Test Settings Feature / test-settings-file-allow (push) Has been cancelled
Test Settings Feature / test-settings-file-deny (push) Has been cancelled
Fork of markwylde/claude-code-gitea-action@b744372 (v1.0.21) with the 'View job' link fixed to use GITHUB_RUN_NUMBER (per-repo index) instead of GITHUB_RUN_ID (global id), because Forgejo routes run pages by per-repo index. See VENDOR.txt.
124 lines
4 KiB
YAML
124 lines
4 KiB
YAML
name: Test Claude Code Action
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
inputs:
|
|
test_prompt:
|
|
description: "Test prompt for Claude"
|
|
required: false
|
|
default: "List the files in the current directory starting with 'package'"
|
|
|
|
jobs:
|
|
test-inline-prompt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
- name: Test with inline prompt
|
|
id: inline-test
|
|
uses: ./base-action
|
|
with:
|
|
prompt: ${{ github.event.inputs.test_prompt || 'List the files in the current directory starting with "package"' }}
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY && secrets.ANTHROPIC_API_KEY || secrets.CLAUDE_CREDENTIALS }}
|
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CREDENTIALS }}
|
|
allowed_tools: "LS,Read"
|
|
timeout_minutes: "3"
|
|
|
|
- name: Verify inline prompt output
|
|
run: |
|
|
OUTPUT_FILE="${{ steps.inline-test.outputs.execution_file }}"
|
|
CONCLUSION="${{ steps.inline-test.outputs.conclusion }}"
|
|
|
|
echo "Conclusion: $CONCLUSION"
|
|
echo "Output file: $OUTPUT_FILE"
|
|
|
|
if [ "$CONCLUSION" = "success" ]; then
|
|
echo "✅ Action completed successfully"
|
|
else
|
|
echo "❌ Action failed"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f "$OUTPUT_FILE" ]; then
|
|
if [ -s "$OUTPUT_FILE" ]; then
|
|
echo "✅ Execution log file created successfully with content"
|
|
echo "Validating JSON format:"
|
|
if jq . "$OUTPUT_FILE" > /dev/null 2>&1; then
|
|
echo "✅ Output is valid JSON"
|
|
echo "Content preview:"
|
|
head -c 200 "$OUTPUT_FILE"
|
|
else
|
|
echo "❌ Output is not valid JSON"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "❌ Execution log file is empty"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "❌ Execution log file not found"
|
|
exit 1
|
|
fi
|
|
|
|
test-prompt-file:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
|
|
- name: Create test prompt file
|
|
run: |
|
|
cat > test-prompt.txt << EOF
|
|
${PROMPT}
|
|
EOF
|
|
env:
|
|
PROMPT: ${{ github.event.inputs.test_prompt || 'List the files in the current directory starting with "package"' }}
|
|
|
|
- name: Test with prompt file and allowed tools
|
|
id: prompt-file-test
|
|
uses: ./base-action
|
|
with:
|
|
prompt_file: "test-prompt.txt"
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY && secrets.ANTHROPIC_API_KEY || secrets.CLAUDE_CREDENTIALS }}
|
|
claude_code_oauth_token: ${{ secrets.CLAUDE_CREDENTIALS }}
|
|
allowed_tools: "LS,Read"
|
|
timeout_minutes: "3"
|
|
|
|
- name: Verify prompt file output
|
|
run: |
|
|
OUTPUT_FILE="${{ steps.prompt-file-test.outputs.execution_file }}"
|
|
CONCLUSION="${{ steps.prompt-file-test.outputs.conclusion }}"
|
|
|
|
echo "Conclusion: $CONCLUSION"
|
|
echo "Output file: $OUTPUT_FILE"
|
|
|
|
if [ "$CONCLUSION" = "success" ]; then
|
|
echo "✅ Action completed successfully"
|
|
else
|
|
echo "❌ Action failed"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f "$OUTPUT_FILE" ]; then
|
|
if [ -s "$OUTPUT_FILE" ]; then
|
|
echo "✅ Execution log file created successfully with content"
|
|
echo "Validating JSON format:"
|
|
if jq . "$OUTPUT_FILE" > /dev/null 2>&1; then
|
|
echo "✅ Output is valid JSON"
|
|
echo "Content preview:"
|
|
head -c 200 "$OUTPUT_FILE"
|
|
else
|
|
echo "❌ Output is not valid JSON"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "❌ Execution log file is empty"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "❌ Execution log file not found"
|
|
exit 1
|
|
fi
|