Skip to content

Commit f26634f

Browse files
committed
Make kernel diff config with AI
1 parent a212f0a commit f26634f

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: "Weekly Journalistic Summary (GitHub Model)"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
schedule:
7+
- cron: '0 9 * * MON'
8+
9+
jobs:
10+
summarize-commits:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
actions: read
15+
16+
steps:
17+
- name: Checkout armbian/build
18+
uses: actions/checkout@v4
19+
with:
20+
repository: armbian/build
21+
fetch-depth: 0
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
29+
- name: Install OpenAI SDK
30+
run: pip install 'openai>=1.0.0'
31+
32+
- name: Generate summary using GitHub model
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.AI_MODELS }}
35+
run: |
36+
python3 << 'EOF'
37+
import os
38+
import subprocess
39+
import datetime
40+
from openai import OpenAI
41+
42+
token = os.environ["GITHUB_TOKEN"]
43+
endpoint = "https://models.github.ai/inference"
44+
model = "openai/gpt-4.1"
45+
46+
client = OpenAI(
47+
base_url=endpoint,
48+
api_key=token,
49+
)
50+
51+
# Get commits from the last week, excluding 'automatic'
52+
today = datetime.date.today()
53+
last_week = today - datetime.timedelta(days=7)
54+
result = subprocess.run(
55+
["git", "log", f"--since={last_week.isoformat()}", "--pretty=format:%h %s (%an)"],
56+
capture_output=True,
57+
text=True
58+
)
59+
commits = [line for line in result.stdout.splitlines() if "automatic" not in line.lower()]
60+
61+
if not commits:
62+
print("No relevant commits found.")
63+
exit(0)
64+
65+
# Prompt
66+
prompt = (
67+
"Write a journalistic-style weekly summary from these Git commit messages:\n\n" +
68+
"\n".join(commits) +
69+
"\n\nSkip trivial or automated changes. Emphasize noteworthy improvements or technical decisions. Format in Markdown."
70+
)
71+
72+
response = client.chat.completions.create(
73+
model=model,
74+
messages=[
75+
{"role": "system", "content": "You are a helpful assistant."},
76+
{"role": "user", "content": prompt}
77+
],
78+
temperature=0.7,
79+
top_p=1.0
80+
)
81+
82+
article = response.choices[0].message.content
83+
with open("weekly-summary.md", "w") as f:
84+
f.write(article)
85+
EOF
86+
87+
- name: Upload Markdown summary
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: weekly-summary
91+
path: weekly-summary.md

0 commit comments

Comments
 (0)