-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (60 loc) · 2.03 KB
/
Copy pathreusable-gemini-tasks.yml
File metadata and controls
68 lines (60 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# .github/workflows/reusable-gemini-tasks.yml
name: Reusable Gemini Tasks
on:
workflow_call:
secrets:
GEMINI_API_KEY:
required: true
ARI_PAT:
required: true
permissions:
contents: read
issues: write
jobs:
scheduled_triage:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v7
with:
node-version: '20'
- run: pnpm install --frozen-lockfile
- name: Fetch Stale Issues
env:
GH_TOKEN: ${{ github.token }}
run: |
gh issue list --state open --limit 100 --json number,title,updatedAt,url > issues.json
- name: Create Task Input
run: |
echo "Analyze these open issues and identify stale ones (older than 30 days) or those needing attention based on project goals. Suggest actions. Issues:" > task_input.txt
cat issues.json >> task_input.txt
- name: Run Gemini Analysis
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SCHEDULED_CONTEXT_FILES: ${{ vars.SCHEDULED_CONTEXT_FILES || 'README.md,FRONTEND_IMPROVEMENT_PLAN.md' }}
run: |
npx tsx scripts/gemini-client.ts \
--task-file "task_input.txt" \
--context "$SCHEDULED_CONTEXT_FILES" \
--output "report.md"
- name: Create Report Issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.ARI_PAT }}
script: |
const fs = require('fs');
try {
const body = fs.readFileSync('report.md', 'utf8');
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Weekly Gemini Triage Report',
body: body
});
} catch (e) {
console.error('No report generated:', e);
core.setFailed('Failed to create triage report');
}