Skip to content

Commit 8fdea5b

Browse files
committed
upd
1 parent 01396dd commit 8fdea5b

File tree

2 files changed

+273
-53
lines changed

2 files changed

+273
-53
lines changed

.github/workflows/bump-version.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ on:
1212
- major
1313
- minor
1414
- patch
15+
ai_provider:
16+
description: 'AI provider to use for analysis (default: gemini)'
17+
required: false
18+
type: choice
19+
default: 'gemini'
20+
options:
21+
- gemini
22+
- openai
23+
- anthropic
1524
schedule:
1625
# Run weekly on Monday at 9:00 AM UTC
1726
- cron: '0 9 * * 1'
@@ -37,7 +46,7 @@ jobs:
3746
- name: Install dependencies
3847
run: |
3948
python -m pip install --upgrade pip
40-
pip install google-generativeai
49+
pip install google-generativeai openai anthropic
4150
4251
- name: Get current version
4352
id: current-version
@@ -67,11 +76,23 @@ jobs:
6776
if: steps.check-existing-pr.outputs.has_existing_pr == 'false'
6877
env:
6978
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
79+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
80+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
7081
run: |
82+
# Determine which AI provider to use
83+
# Priority: manual input > default (gemini)
84+
if [ -n "${{ inputs.ai_provider }}" ]; then
85+
AI_PROVIDER="${{ inputs.ai_provider }}"
86+
else
87+
AI_PROVIDER="gemini"
88+
fi
89+
90+
echo "Using AI provider: ${AI_PROVIDER}"
7191
echo "Analyzing commits to determine version bump..."
7292
73-
# Run AI analysis
93+
# Run AI analysis with specified provider
7494
python scripts/ai_determine_version_bump.py \
95+
--provider ${AI_PROVIDER} \
7596
--output-format json \
7697
--verbose > /tmp/analysis.json 2>&1
7798
@@ -82,12 +103,13 @@ jobs:
82103
83104
echo "bump_type=${BUMP_TYPE}" >> $GITHUB_OUTPUT
84105
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
106+
echo "ai_provider=${AI_PROVIDER}" >> $GITHUB_OUTPUT
85107
86108
# Save reasoning and key changes for PR body
87109
jq -r '.reasoning' /tmp/analysis.json > /tmp/reasoning.txt
88110
jq -r '.key_changes[]' /tmp/analysis.json > /tmp/key_changes.txt || echo "" > /tmp/key_changes.txt
89111
90-
echo "AI Analysis Result:"
112+
echo "AI Analysis Result (${AI_PROVIDER}):"
91113
echo " Bump type: ${BUMP_TYPE}"
92114
echo " New version: ${NEW_VERSION}"
93115
echo " Reasoning: ${REASONING}"
@@ -159,6 +181,7 @@ jobs:
159181
BUMP_TYPE="${{ steps.final-decision.outputs.bump_type }}"
160182
NEW_VERSION="${{ steps.final-decision.outputs.new_version }}"
161183
CURRENT_VERSION="${{ steps.current-version.outputs.version }}"
184+
AI_PROVIDER="${{ steps.analyze.outputs.ai_provider }}"
162185
163186
# Read AI reasoning
164187
REASONING=$(cat /tmp/reasoning.txt || echo "Manual version bump")
@@ -172,7 +195,7 @@ jobs:
172195

173196
This PR bumps the version from **v$CURRENT_VERSION** to **v$NEW_VERSION** ($BUMP_TYPE_UPPER bump).
174197

175-
### AI Analysis
198+
### AI Analysis$AI_PROVIDER_TEXT
176199

177200
$REASONING
178201

@@ -215,6 +238,13 @@ EOF
215238
sed -i "s|\$REASONING|$REASONING|g" /tmp/pr_body.md
216239
sed -i "s/\$RUN_ID/${{ github.run_id }}/g" /tmp/pr_body.md
217240

241+
# Add AI provider info if available
242+
if [ -n "$AI_PROVIDER" ]; then
243+
sed -i "s/\$AI_PROVIDER_TEXT/ (using $AI_PROVIDER)/g" /tmp/pr_body.md
244+
else
245+
sed -i "s/\$AI_PROVIDER_TEXT//g" /tmp/pr_body.md
246+
fi
247+
218248
cat /tmp/pr_body.md
219249

220250
- name: Create Pull Request
@@ -246,6 +276,11 @@ EOF
246276
echo "- **Current version**: ${{ steps.current-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
247277
echo "- **New version**: ${{ steps.final-decision.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
248278
echo "- **Bump type**: ${{ steps.final-decision.outputs.bump_type }}" >> $GITHUB_STEP_SUMMARY
279+
280+
# Add AI provider info if available
281+
if [ -n "${{ steps.analyze.outputs.ai_provider }}" ]; then
282+
echo "- **AI provider**: ${{ steps.analyze.outputs.ai_provider }}" >> $GITHUB_STEP_SUMMARY
283+
fi
249284
else
250285
echo "ℹ️ No version bump needed" >> $GITHUB_STEP_SUMMARY
251286
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)