This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Improvement with Optimized Code Model | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
improve-code: | |
name: Improve Code with Optimized Code Model | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Set up PHP | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
tools: composer, php-cs-fixer, phpstan | |
# Install dependencies | |
- name: Install Composer Dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
# Install Ollama CLI | |
- name: Install Ollama CLI | |
run: | | |
curl -fsSL https://ollama.ai/install.sh | bash | |
# Download and prepare the model (optimized for code improvement) | |
- name: Download Ollama Code Model | |
run: | | |
ollama pull codellama | |
# Run Ollama for code improvement | |
- name: Run Ollama for Code Improvement | |
run: | | |
ollama run codellama \ | |
--input "Analyze and improve the PHP code in the ./ directory. | |
Make it robust, solid, strictly typed, add PHPDoc, integrate Spatie Laravel Data and QueableActions, | |
and follow modern PHP best practices. Ensure compatibility with PHP 8.2." | |
# Run PHP-CS-Fixer for formatting | |
#- name: Run PHP-CS-Fixer | |
# run: vendor/bin/php-cs-fixer fix --verbose | |
# Run PHPStan for static analysis | |
#- name: Run PHPStan | |
# run: vendor/bin/phpstan analyse --level=max | |
# Commit and push changes | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "GitHub Actions Bot" | |
git config --global user.email "[email protected]" | |
git add . | |
git commit -m "Automated code improvements by Ollama and GitHub Actions" || echo "No changes to commit" | |
git push |