Skip to content

Commit 35761ea

Browse files
committed
refactor(actions, workflows): standardize input variable usage in YAML files
Updated action and workflow files to use consistent input variable references. This includes changes to environment variable handling for better clarity and maintainability, enhancing code quality and reducing potential errors.
1 parent e122d7d commit 35761ea

7 files changed

Lines changed: 76 additions & 47 deletions

File tree

.github/actions/claude-code-action/action.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ runs:
7070

7171
- name: Install GitHub MCP Server
7272
shell: bash
73+
env:
74+
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
7375
run: |
7476
claude mcp add-json github '{
7577
"command": "docker",
@@ -82,7 +84,7 @@ runs:
8284
"ghcr.io/github/github-mcp-server:sha-ff3036d"
8385
],
8486
"env": {
85-
"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ inputs.github_token }}"
87+
"GITHUB_PERSONAL_ACCESS_TOKEN": "'"${INPUT_GITHUB_TOKEN}"'"
8688
}
8789
}'
8890
@@ -254,37 +256,41 @@ runs:
254256
- name: Run Claude Code
255257
if: env.SKIP_EXECUTION != 'true'
256258
shell: bash
259+
env:
260+
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
261+
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
262+
GITHUB_TOKEN: ${{ inputs.github_token }}
263+
INPUT_MAX_TURNS: ${{ inputs.max_turns }}
264+
INPUT_ALLOWED_TOOLS: ${{ inputs.allowed_tools }}
265+
INPUT_DISALLOWED_TOOLS: ${{ inputs.disallowed_tools }}
266+
INPUT_TIMEOUT_MINUTES: ${{ inputs.timeout_minutes }}
257267
run: |
258268
echo "🚀 Running Claude Code with GitHub context..."
259269
260270
# Build command arguments
261271
CMD_ARGS=("-p" "--verbose" "--output-format" "stream-json")
262272
263273
# Add max turns if specified
264-
if [[ -n "${{ inputs.max_turns }}" ]]; then
265-
CMD_ARGS+=("--max-turns" "${{ inputs.max_turns }}")
274+
if [[ -n "$INPUT_MAX_TURNS" ]]; then
275+
CMD_ARGS+=("--max-turns" "$INPUT_MAX_TURNS")
266276
fi
267277
268278
# Add allowed tools (include GitHub tools by default)
269279
TOOLS="mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues,mcp__github__create_comment,Read,Write,Edit,Bash"
270-
if [[ -n "${{ inputs.allowed_tools }}" ]]; then
271-
TOOLS="$TOOLS,${{ inputs.allowed_tools }}"
280+
if [[ -n "$INPUT_ALLOWED_TOOLS" ]]; then
281+
TOOLS="$TOOLS,$INPUT_ALLOWED_TOOLS"
272282
fi
273283
CMD_ARGS+=("--allowedTools" "$TOOLS")
274284
275285
# Add disallowed tools
276-
if [[ -n "${{ inputs.disallowed_tools }}" ]]; then
277-
CMD_ARGS+=("--disallowedTools" "${{ inputs.disallowed_tools }}")
286+
if [[ -n "$INPUT_DISALLOWED_TOOLS" ]]; then
287+
CMD_ARGS+=("--disallowedTools" "$INPUT_DISALLOWED_TOOLS")
278288
fi
279289
280290
echo "📝 Executing Claude Code with prompt from file..."
281291
282292
# Execute Claude Code with timeout, using stdin for the prompt
283-
TIMEOUT_SECONDS=$((${{ inputs.timeout_minutes }} * 60))
284-
timeout $TIMEOUT_SECONDS claude "${CMD_ARGS[@]}" < "${{ env.PROMPT_FILE }}"
293+
TIMEOUT_SECONDS=$(($INPUT_TIMEOUT_MINUTES * 60))
294+
timeout $TIMEOUT_SECONDS claude "${CMD_ARGS[@]}" < "$PROMPT_FILE"
285295
286-
echo "✅ Claude Code execution completed"
287-
env:
288-
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
289-
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
290-
GITHUB_TOKEN: ${{ inputs.github_token }}
296+
echo "✅ Claude Code execution completed"

.github/actions/gemini/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ runs:
5757

5858
- name: Install Gemini CLI
5959
id: install
60+
env:
61+
INPUT_VERSION: ${{ inputs.version }}
6062
run: |
61-
if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.-]+)?(\+[a-zA-Z0-9\.-]+)?$ ]]; then
62-
echo "Installing Gemini CLI from npm: @google/gemini-cli@${{ inputs.version }}"
63-
npm install -g @google/gemini-cli@${{ inputs.version }}
63+
if [[ "$INPUT_VERSION" == "latest" || "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.-]+)?(\+[a-zA-Z0-9\.-]+)?$ ]]; then
64+
echo "Installing Gemini CLI from npm: @google/gemini-cli@$INPUT_VERSION"
65+
npm install -g @google/gemini-cli@$INPUT_VERSION
6466
else
65-
echo "Installing Gemini CLI from GitHub: github:google-gemini/gemini-cli#${{ inputs.version }}"
66-
npm install -g github:google-gemini/gemini-cli#${{ inputs.version }}
67+
echo "Installing Gemini CLI from GitHub: github:google-gemini/gemini-cli#$INPUT_VERSION"
68+
npm install -g github:google-gemini/gemini-cli#$INPUT_VERSION
6769
fi
6870
echo "Verifying installation:"
6971
if command -v gemini >/dev/null 2>&1; then

.github/workflows/benchmark.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
3636
- name: Run Import Time Benchmark
3737
id: import_time
38+
env:
39+
FAIL_ON_REGRESSION: ${{ inputs.fail_on_regression }}
3840
run: |
3941
cd src/praisonai-agents
4042
python benchmarks/import_time.py 2>&1 | tee import_time_output.txt
@@ -46,7 +48,7 @@ jobs:
4648
# Check threshold (200ms)
4749
if (( $(echo "$IMPORT_TIME > 200" | bc -l) )); then
4850
echo "::warning::Import time ${IMPORT_TIME}ms exceeds 200ms threshold"
49-
if [ "${{ inputs.fail_on_regression }}" == "true" ]; then
51+
if [ "$FAIL_ON_REGRESSION" == "true" ]; then
5052
echo "import_passed=false" >> $GITHUB_OUTPUT
5153
fi
5254
else
@@ -55,6 +57,8 @@ jobs:
5557
5658
- name: Run Memory Usage Benchmark
5759
id: memory
60+
env:
61+
FAIL_ON_REGRESSION: ${{ inputs.fail_on_regression }}
5862
run: |
5963
cd src/praisonai-agents
6064
python benchmarks/memory_usage.py 2>&1 | tee memory_output.txt
@@ -66,7 +70,7 @@ jobs:
6670
# Check threshold (30MB)
6771
if (( $(echo "$PEAK_MEMORY > 30" | bc -l) )); then
6872
echo "::warning::Memory usage ${PEAK_MEMORY}MB exceeds 30MB threshold"
69-
if [ "${{ inputs.fail_on_regression }}" == "true" ]; then
73+
if [ "$FAIL_ON_REGRESSION" == "true" ]; then
7074
echo "memory_passed=false" >> $GITHUB_OUTPUT
7175
fi
7276
else
@@ -95,9 +99,11 @@ jobs:
9599
96100
- name: Run Parameter Impact Benchmark
97101
id: param_impact
102+
env:
103+
INPUT_ITERATIONS: ${{ inputs.iterations }}
98104
run: |
99105
cd src/praisonai-agents
100-
python benchmarks/param_impact_benchmark.py --no-save --iterations ${{ inputs.iterations }} 2>&1 | tee param_impact_output.txt
106+
python benchmarks/param_impact_benchmark.py --no-save --iterations "$INPUT_ITERATIONS" 2>&1 | tee param_impact_output.txt
101107
102108
- name: Check Lazy Imports
103109
id: lazy_imports

.github/workflows/release.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ jobs:
3434
# Get the commit hash from the tag
3535
- name: Get commit hash
3636
id: get_commit
37+
env:
38+
INPUT_TAG: ${{ github.event.inputs.tag }}
3739
run: |
3840
COMMIT_HASH=$(git rev-parse HEAD)
3941
echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
40-
echo "Found commit: $COMMIT_HASH for tag ${{ github.event.inputs.tag }}"
42+
echo "Found commit: $COMMIT_HASH for tag $INPUT_TAG"
4143
4244
# Now checkout the fork at main branch
4345
- name: Checkout fork
@@ -445,42 +447,48 @@ jobs:
445447
# Add upstream and get commit from tag
446448
- name: Get upstream tag commit
447449
id: get_upstream_commit
450+
env:
451+
INPUT_TAG: ${{ github.event.inputs.tag }}
448452
run: |
449453
# Add upstream remote
450454
git remote add upstream https://github.com/MervinPraison/PraisonAI.git
451455
452456
# Delete local tag if it exists
453-
git tag -d ${{ github.event.inputs.tag }} || true
457+
git tag -d "$INPUT_TAG" || true
454458
455459
# Fetch from upstream including tags with force
456460
git fetch upstream --tags --force
457461
458462
# Verify tag exists in upstream
459-
if ! git ls-remote --tags upstream | grep -q "refs/tags/${{ github.event.inputs.tag }}$"; then
460-
echo "::error::Tag ${{ github.event.inputs.tag }} not found in upstream repository"
463+
if ! git ls-remote --tags upstream | grep -q "refs/tags/$INPUT_TAG$"; then
464+
echo "::error::Tag $INPUT_TAG not found in upstream repository"
461465
exit 1
462466
fi
463467
464468
# Get the commit hash from the upstream tag
465-
UPSTREAM_COMMIT=$(git rev-list -n 1 refs/tags/${{ github.event.inputs.tag }})
469+
UPSTREAM_COMMIT=$(git rev-list -n 1 refs/tags/"$INPUT_TAG")
466470
if [ -z "$UPSTREAM_COMMIT" ]; then
467-
echo "::error::Could not find commit for tag ${{ github.event.inputs.tag }}"
471+
echo "::error::Could not find commit for tag $INPUT_TAG"
468472
exit 1
469473
fi
470474
echo "upstream_commit=$UPSTREAM_COMMIT" >> $GITHUB_OUTPUT
471-
echo "Found commit: $UPSTREAM_COMMIT for tag ${{ github.event.inputs.tag }}"
475+
echo "Found commit: $UPSTREAM_COMMIT for tag $INPUT_TAG"
472476
473477
# Create tag at the same commit
474478
- name: Create tag at commit
479+
env:
480+
GIT_ASKPASS: /bin/echo
481+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
482+
INPUT_TAG: ${{ github.event.inputs.tag }}
475483
run: |
476484
git config --global user.name "MervinPraison"
477485
git config --global user.email "454862+MervinPraison@users.noreply.github.com"
478486
479487
# Remove tag if it exists locally
480-
git tag -d ${{ github.event.inputs.tag }} || true
488+
git tag -d "$INPUT_TAG" || true
481489
482490
# Remove tag if it exists remotely
483-
git push origin :refs/tags/${{ github.event.inputs.tag }} || true
491+
git push origin :refs/tags/"$INPUT_TAG" || true
484492
485493
# Fetch the specific commit from upstream
486494
git fetch upstream ${{ steps.get_upstream_commit.outputs.upstream_commit }} --force
@@ -489,11 +497,8 @@ jobs:
489497
git reset --hard ${{ steps.get_upstream_commit.outputs.upstream_commit }}
490498
491499
# Create and push tag
492-
git tag -a ${{ github.event.inputs.tag }} -m "Release ${{ github.event.inputs.tag }} (synced from upstream MervinPraison/PraisonAI@${{ github.event.inputs.tag }})"
493-
git push origin ${{ github.event.inputs.tag }}
494-
env:
495-
GIT_ASKPASS: /bin/echo
496-
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
500+
git tag -a "$INPUT_TAG" -m "Release $INPUT_TAG (synced from upstream MervinPraison/PraisonAI@$INPUT_TAG)"
501+
git push origin "$INPUT_TAG"
497502
498503
# Create the release
499504
- name: Create Release

.github/workflows/test-comprehensive.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ jobs:
6767
fi
6868
6969
- name: Run Comprehensive Test Suite
70+
env:
71+
INPUT_TEST_TYPE: ${{ github.event.inputs.test_type || 'all' }}
7072
run: |
7173
# Determine test type from input or default to 'all'
72-
TEST_TYPE="${{ github.event.inputs.test_type || 'all' }}"
74+
TEST_TYPE="$INPUT_TEST_TYPE"
7375
7476
echo "🧪 Running comprehensive test suite (type: $TEST_TYPE)"
7577
@@ -102,11 +104,13 @@ jobs:
102104
103105
- name: Generate Comprehensive Test Report
104106
if: always()
107+
env:
108+
INPUT_TEST_TYPE: ${{ github.event.inputs.test_type || 'all' }}
105109
run: |
106110
echo "# 📋 Comprehensive Test Report" > comprehensive_report.md
107111
echo "" >> comprehensive_report.md
108112
echo "**Python Version:** ${{ matrix.python-version }}" >> comprehensive_report.md
109-
echo "**Test Type:** ${{ github.event.inputs.test_type || 'all' }}" >> comprehensive_report.md
113+
echo "**Test Type:** $INPUT_TEST_TYPE" >> comprehensive_report.md
110114
echo "**Trigger:** ${{ github.event_name }}" >> comprehensive_report.md
111115
echo "**Date:** $(date -u)" >> comprehensive_report.md
112116
echo "" >> comprehensive_report.md

.github/workflows/test-real.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ jobs:
3434

3535
steps:
3636
- name: 🚨 Cost Warning
37+
env:
38+
INPUT_FRAMEWORK: ${{ github.event.inputs.framework }}
39+
INPUT_CONFIRM_COSTS: ${{ github.event.inputs.confirm_costs }}
3740
run: |
3841
echo "⚠️ WARNING: This workflow will make real API calls!"
3942
echo "💰 This may incur charges on your API accounts"
40-
echo "🎯 Framework: ${{ github.event.inputs.framework }}"
41-
echo "✅ Cost confirmation: ${{ github.event.inputs.confirm_costs }}"
43+
echo "🎯 Framework: $INPUT_FRAMEWORK"
44+
echo "✅ Cost confirmation: $INPUT_CONFIRM_COSTS"
4245
4346
- name: Checkout code
4447
uses: actions/checkout@v4
@@ -93,12 +96,14 @@ jobs:
9396

9497
- name: Generate Real Test Report
9598
if: always()
99+
env:
100+
INPUT_FRAMEWORK: ${{ github.event.inputs.framework }}
96101
run: |
97102
echo "# 🔥 Real End-to-End Test Report" > real_test_report.md
98103
echo "" >> real_test_report.md
99104
echo "⚠️ **WARNING: This report represents tests that made real API calls**" >> real_test_report.md
100105
echo "" >> real_test_report.md
101-
echo "**Framework Tested:** ${{ github.event.inputs.framework }}" >> real_test_report.md
106+
echo "**Framework Tested:** $INPUT_FRAMEWORK" >> real_test_report.md
102107
echo "**Python Version:** ${{ matrix.python-version }}" >> real_test_report.md
103108
echo "**Date:** $(date -u)" >> real_test_report.md
104109
echo "**Triggered by:** ${{ github.actor }}" >> real_test_report.md
@@ -107,15 +112,15 @@ jobs:
107112
echo "## 🧪 Test Results" >> real_test_report.md
108113
echo "" >> real_test_report.md
109114
110-
if [ "${{ github.event.inputs.framework }}" == "autogen" ] || [ "${{ github.event.inputs.framework }}" == "all" ]; then
115+
if [ "$INPUT_FRAMEWORK" == "autogen" ] || [ "$INPUT_FRAMEWORK" == "all" ]; then
111116
echo "### AutoGen Real Tests:" >> real_test_report.md
112117
echo "- Environment verification" >> real_test_report.md
113118
echo "- Agent creation with real API calls" >> real_test_report.md
114119
echo "- Configuration validation" >> real_test_report.md
115120
echo "" >> real_test_report.md
116121
fi
117122
118-
if [ "${{ github.event.inputs.framework }}" == "crewai" ] || [ "${{ github.event.inputs.framework }}" == "all" ]; then
123+
if [ "$INPUT_FRAMEWORK" == "crewai" ] || [ "$INPUT_FRAMEWORK" == "all" ]; then
119124
echo "### CrewAI Real Tests:" >> real_test_report.md
120125
echo "- Environment verification" >> real_test_report.md
121126
echo "- Crew creation with real API calls" >> real_test_report.md
@@ -150,11 +155,14 @@ jobs:
150155

151156
steps:
152157
- name: 🛡️ Safety Check Failed
158+
env:
159+
INPUT_FRAMEWORK: ${{ github.event.inputs.framework }}
160+
INPUT_CONFIRM_COSTS: ${{ github.event.inputs.confirm_costs }}
153161
run: |
154162
echo "🚨 Real tests not executed due to safety checks:"
155163
echo ""
156-
echo "✅ Costs confirmed: ${{ github.event.inputs.confirm_costs }}"
157-
echo "✅ Framework selected: ${{ github.event.inputs.framework }}"
164+
echo "✅ Costs confirmed: $INPUT_CONFIRM_COSTS"
165+
echo "✅ Framework selected: $INPUT_FRAMEWORK"
158166
echo ""
159167
echo "To run real tests:"
160168
echo "1. Select a framework (autogen, crewai, or all)"

test_injection.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)