Commit: fix lazyjournal-log output for final report on wiki #146
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: AI Commit Review | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| run-name: "Commit: ${{ github.event.head_commit.message }}" | |
| jobs: | |
| analyze_last_commit: | |
| permissions: | |
| contents: read | |
| models: read | |
| runs-on: ubuntu-latest | |
| env: | |
| LAST_COMMIT: 'n/a' | |
| DIFF_DATA: '' | |
| steps: | |
| - name: Checkout repository (main branch and 2 last commits) | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Get diff from last commit | |
| run: | | |
| LAST_COMMIT=$(git rev-parse --short HEAD) | |
| echo "LAST_COMMIT=$LAST_COMMIT" >> $GITHUB_ENV | |
| DIFF=$(git diff HEAD^ HEAD) | |
| printf "DIFF_DATA<<EOF\n%s\nEOF\n" "$DIFF" >> $GITHUB_ENV | |
| - name: Send message to Telegram | |
| uses: appleboy/telegram-action@master | |
| with: | |
| token: ${{ secrets.TELEGRAM_API_TOKEN }} | |
| to: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| debug: true | |
| format: markdown | |
| message: | | |
| 🔔 **Action**: commit [${{ env.LAST_COMMIT }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) | |
| 📁 **Repository**: ${{ github.repository }} | |
| 👤 **User**: ${{ github.actor }} | |
| 💬 **Message**: ${{ github.event.head_commit.message }} | |
| - name: Generate report using AI | |
| id: ai_query | |
| uses: actions/ai-inference@v2 | |
| with: | |
| model: gpt-4.1 | |
| max-tokens: 2048 | |
| system-prompt: | | |
| You are a technical writer (commit reviewer) in Russian. | |
| Analyze the provided git diff of the latest commit. | |
| Based on this analysis, provide a brief description of the changes and detailed suggestions for improvement or refinement. | |
| The message must contain two sections: "💡 Обзор изменений" and "💁♂️ Рекомендации по улучшению" without heading symbols. | |
| The response must be strictly in Markdown format and adhere to the 3500 character limit for sending messages in Telegram. | |
| prompt: | | |
| Analyze the following code changes in commit ${{ env.LAST_COMMIT }}: | |
| ${{ env.DIFF_DATA }} | |
| - name: Send AI report to Telegram | |
| uses: appleboy/telegram-action@master | |
| continue-on-error: true | |
| with: | |
| token: ${{ secrets.TELEGRAM_API_TOKEN }} | |
| to: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| debug: true | |
| format: markdown | |
| message: | | |
| 🔔 Report for ${{ env.LAST_COMMIT }} commit from AI | |
| ${{ steps.ai_query.outputs.response }} |