Files
lazyjournal/.github/workflows/issue-analysis.yml
2026-01-24 12:45:07 +03:00

66 lines
2.2 KiB
YAML

name: AI Issue Analysis
on:
issues:
types: [opened, closed, reopened]
issue_comment:
types: [created]
run-name: "Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}"
jobs:
issue_analysis:
permissions:
issues: write
models: read
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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**: ${{ github.event_name }} ${{ github.event.action }} [#${{ github.event.issue.number }}](${{ github.event.comment.html_url || github.event.issue.html_url }})
📁 **Repository**: ${{ github.repository }}
👤 **From user**: ${{ github.actor }}
📌 **Title**: ${{ github.event.issue.title }}
💬 **Description**:
${{ github.event.comment.body || github.event.issue.body }}
- name: Generate report using AI
if: github.event_name == 'issues' && github.event.action == 'opened'
id: ai_query
uses: actions/ai-inference@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
endpoint: https://models.github.ai/inference
model: gpt-4.1
max-tokens: 1024
system-prompt: |
You are a developer assistant.
Your job is to analyze issues on GitHub and suggest solutions.
Your responses should be brief and in English.
prompt: |
Title: ${{ github.event.issue.title }}
Description: ${{ github.event.issue.body }}
- name: Post comment from AI
if: github.event_name == 'issues' && github.event.action == 'opened' && steps.ai_query.outputs.response != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
AI_RESPONSE: ${{ steps.ai_query.outputs.response }}
run: |
gh pr comment "$PR_NUMBER" --body "### AI Issue Analysis
$AI_RESPONSE"