Skip to content

Commit 9109e5c

Browse files
committed
chore(ci): change notifications settings
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 71a84b9 commit 9109e5c

File tree

2 files changed

+22
-39
lines changed

2 files changed

+22
-39
lines changed

.github/workflows/notify-models.yaml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@ on:
77
jobs:
88
notify-discord:
99
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
10-
env:
11-
MODEL_NAME: gemma-3-12b-it
1210
runs-on: ubuntu-latest
1311
steps:
1412
- uses: actions/checkout@v5
1513
with:
1614
fetch-depth: 0 # needed to checkout all branches for this Action to work
17-
- uses: mudler/localai-github-action@v1
18-
with:
19-
model: 'gemma-3-12b-it' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file"
2015
# Check the PR diff using the current branch and the base branch of the PR
2116
- uses: GrantBirki/git-diff-action@v2.8.1
2217
id: git-diff-action
@@ -27,16 +22,16 @@ jobs:
2722
- name: Summarize
2823
env:
2924
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }}
25+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
26+
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
27+
OPENAI_MODEL: "gemma-3-27b-it-qat"
3028
id: summarize
3129
run: |
3230
input="$(cat $DIFF)"
3331
34-
# Define the LocalAI API endpoint
35-
API_URL="http://localhost:8080/chat/completions"
36-
3732
# Create a JSON payload using jq to handle special characters
3833
json_payload=$(jq -n --arg input "$input" '{
39-
model: "'$MODEL_NAME'",
34+
model: "'$OPENAI_MODEL'",
4035
messages: [
4136
{
4237
role: "system",
@@ -49,16 +44,16 @@ jobs:
4944
]
5045
}')
5146
52-
# Send the request to LocalAI
53-
response=$(curl -s -X POST $API_URL \
47+
# Send the request to OpenAI API
48+
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
5449
-H "Content-Type: application/json" \
50+
-H "Authorization: Bearer $OPENAI_API_KEY" \
5551
-d "$json_payload")
5652
5753
# Extract the summary from the response
5854
summary="$(echo $response | jq -r '.choices[0].message.content')"
5955
6056
# Print the summary
61-
# -H "Authorization: Bearer $API_KEY" \
6257
echo "Summary:"
6358
echo "$summary"
6459
echo "payload sent"
@@ -68,7 +63,6 @@ jobs:
6863
echo "$summary"
6964
echo EOF
7065
} >> "$GITHUB_OUTPUT"
71-
docker logs --tail 10 local-ai
7266
- name: Discord notification
7367
env:
7468
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
@@ -86,18 +80,11 @@ jobs:
8680
limit-access-to-actor: true
8781
notify-twitter:
8882
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
89-
env:
90-
MODEL_NAME: gemma-3-12b-it
9183
runs-on: ubuntu-latest
9284
steps:
9385
- uses: actions/checkout@v5
9486
with:
9587
fetch-depth: 0 # needed to checkout all branches for this Action to work
96-
- name: Start LocalAI
97-
run: |
98-
echo "Starting LocalAI..."
99-
docker run -e -ti -d --name local-ai -p 8080:8080 localai/localai:master run --debug $MODEL_NAME
100-
until [ "`docker inspect -f {{.State.Health.Status}} local-ai`" == "healthy" ]; do echo "Waiting for container to be ready"; docker logs --tail 10 local-ai; sleep 2; done
10188
# Check the PR diff using the current branch and the base branch of the PR
10289
- uses: GrantBirki/git-diff-action@v2.8.1
10390
id: git-diff-action
@@ -108,20 +95,20 @@ jobs:
10895
- name: Summarize
10996
env:
11097
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }}
98+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
99+
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
100+
OPENAI_MODEL: "gemma-3-27b-it-qat"
111101
id: summarize
112102
run: |
113103
input="$(cat $DIFF)"
114104
115-
# Define the LocalAI API endpoint
116-
API_URL="http://localhost:8080/chat/completions"
117-
118105
# Create a JSON payload using jq to handle special characters
119106
json_payload=$(jq -n --arg input "$input" '{
120-
model: "'$MODEL_NAME'",
107+
model: "'$OPENAI_MODEL'",
121108
messages: [
122109
{
123110
role: "system",
124-
content: "You are LocalAI-bot. Write a twitter message to notify everyone about the new model from the git diff. Make it informal and really short. An example can include: the name, and a brief description of the model if exists. Also add an hint on how to install it in LocalAI. For example: local-ai run model_name_here"
111+
content: "You are LocalAI-bot. Write a short, twitter message to notify everyone about the new model from the git diff. Make it informal and really short, less than 250 characters. An example can include: the name, and a brief description of the model if exists. Also add an hint on how to install it in LocalAI. For example: local-ai run model_name_here"
125112
},
126113
{
127114
role: "user",
@@ -130,16 +117,16 @@ jobs:
130117
]
131118
}')
132119
133-
# Send the request to LocalAI
134-
response=$(curl -s -X POST $API_URL \
120+
# Send the request to OpenAI API
121+
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
135122
-H "Content-Type: application/json" \
123+
-H "Authorization: Bearer $OPENAI_API_KEY" \
136124
-d "$json_payload")
137125
138126
# Extract the summary from the response
139127
summary="$(echo $response | jq -r '.choices[0].message.content')"
140128
141129
# Print the summary
142-
# -H "Authorization: Bearer $API_KEY" \
143130
echo "Summary:"
144131
echo "$summary"
145132
echo "payload sent"
@@ -149,7 +136,6 @@ jobs:
149136
echo "$summary"
150137
echo EOF
151138
} >> "$GITHUB_OUTPUT"
152-
docker logs --tail 10 local-ai
153139
- uses: Eomm/why-don-t-you-tweet@v2
154140
with:
155141
tweet-message: ${{ steps.summarize.outputs.message }}

.github/workflows/notify-releases.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ jobs:
1111
RELEASE_BODY: ${{ github.event.release.body }}
1212
RELEASE_TITLE: ${{ github.event.release.name }}
1313
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
14+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
15+
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
16+
OPENAI_MODEL: "gemma-3-27b-it-qat"
1417
steps:
15-
- uses: mudler/localai-github-action@v1
16-
with:
17-
model: 'gemma-3-12b-it' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file"
1818
- name: Summarize
1919
id: summarize
2020
run: |
2121
input="$RELEASE_TITLE\b$RELEASE_BODY"
2222
23-
# Define the LocalAI API endpoint
24-
API_URL="http://localhost:8080/chat/completions"
25-
2623
# Create a JSON payload using jq to handle special characters
2724
json_payload=$(jq -n --arg input "$input" '{
28-
model: "'$MODEL_NAME'",
25+
model: "'$OPENAI_MODEL'",
2926
messages: [
3027
{
3128
role: "system",
@@ -38,16 +35,16 @@ jobs:
3835
]
3936
}')
4037
41-
# Send the request to LocalAI API
42-
response=$(curl -s -X POST $API_URL \
38+
# Send the request to OpenAI API
39+
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
4340
-H "Content-Type: application/json" \
41+
-H "Authorization: Bearer $OPENAI_API_KEY" \
4442
-d "$json_payload")
4543
4644
# Extract the summary from the response
4745
summary=$(echo $response | jq -r '.choices[0].message.content')
4846
4947
# Print the summary
50-
# -H "Authorization: Bearer $API_KEY" \
5148
{
5249
echo 'message<<EOF'
5350
echo "$summary"

0 commit comments

Comments
 (0)