Skip to content

Commit 0309615

Browse files
committed
Revert "chore(ci): change notifications settings"
This reverts commit 9109e5c.
1 parent 22c9e8c commit 0309615

File tree

2 files changed

+42
-22
lines changed

2 files changed

+42
-22
lines changed

.github/workflows/notify-models.yaml

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ permissions:
1111
jobs:
1212
notify-discord:
1313
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
14+
env:
15+
MODEL_NAME: gemma-3-12b-it-qat
1416
runs-on: ubuntu-latest
1517
steps:
1618
- uses: actions/checkout@v5
1719
with:
1820
fetch-depth: 0 # needed to checkout all branches for this Action to work
1921
ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR head to get the actual changes
22+
- uses: mudler/localai-github-action@v1
23+
with:
24+
model: 'gemma-3-12b-it-qat' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file"
25+
# Check the PR diff using the current branch and the base branch of the PR
2026
- uses: GrantBirki/git-diff-action@v2.8.1
2127
id: git-diff-action
2228
with:
@@ -26,16 +32,16 @@ jobs:
2632
- name: Summarize
2733
env:
2834
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }}
29-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
30-
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
31-
OPENAI_MODEL: "gemma-3-27b-it-qat"
3235
id: summarize
3336
run: |
3437
input="$(cat $DIFF)"
3538
39+
# Define the LocalAI API endpoint
40+
API_URL="http://localhost:8080/chat/completions"
41+
3642
# Create a JSON payload using jq to handle special characters
3743
json_payload=$(jq -n --arg input "$input" '{
38-
model: "'$OPENAI_MODEL'",
44+
model: "'$MODEL_NAME'",
3945
messages: [
4046
{
4147
role: "system",
@@ -48,16 +54,16 @@ jobs:
4854
]
4955
}')
5056
51-
# Send the request to OpenAI API
52-
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
57+
# Send the request to LocalAI
58+
response=$(curl -s -X POST $API_URL \
5359
-H "Content-Type: application/json" \
54-
-H "Authorization: Bearer $OPENAI_API_KEY" \
5560
-d "$json_payload")
5661
5762
# Extract the summary from the response
5863
summary="$(echo $response | jq -r '.choices[0].message.content')"
5964
6065
# Print the summary
66+
# -H "Authorization: Bearer $API_KEY" \
6167
echo "Summary:"
6268
echo "$summary"
6369
echo "payload sent"
@@ -67,6 +73,7 @@ jobs:
6773
echo "$summary"
6874
echo EOF
6975
} >> "$GITHUB_OUTPUT"
76+
docker logs --tail 10 local-ai
7077
- name: Discord notification
7178
env:
7279
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
@@ -84,12 +91,20 @@ jobs:
8491
limit-access-to-actor: true
8592
notify-twitter:
8693
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }}
94+
env:
95+
MODEL_NAME: gemma-3-12b-it-qat
8796
runs-on: ubuntu-latest
8897
steps:
8998
- uses: actions/checkout@v5
9099
with:
91100
fetch-depth: 0 # needed to checkout all branches for this Action to work
92101
ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR head to get the actual changes
102+
- name: Start LocalAI
103+
run: |
104+
echo "Starting LocalAI..."
105+
docker run -e -ti -d --name local-ai -p 8080:8080 localai/localai:master run --debug $MODEL_NAME
106+
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
107+
# Check the PR diff using the current branch and the base branch of the PR
93108
- uses: GrantBirki/git-diff-action@v2.8.1
94109
id: git-diff-action
95110
with:
@@ -99,20 +114,20 @@ jobs:
99114
- name: Summarize
100115
env:
101116
DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }}
102-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
103-
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
104-
OPENAI_MODEL: "gemma-3-27b-it-qat"
105117
id: summarize
106118
run: |
107119
input="$(cat $DIFF)"
108120
121+
# Define the LocalAI API endpoint
122+
API_URL="http://localhost:8080/chat/completions"
123+
109124
# Create a JSON payload using jq to handle special characters
110125
json_payload=$(jq -n --arg input "$input" '{
111-
model: "'$OPENAI_MODEL'",
126+
model: "'$MODEL_NAME'",
112127
messages: [
113128
{
114129
role: "system",
115-
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"
130+
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"
116131
},
117132
{
118133
role: "user",
@@ -121,16 +136,16 @@ jobs:
121136
]
122137
}')
123138
124-
# Send the request to OpenAI API
125-
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
139+
# Send the request to LocalAI
140+
response=$(curl -s -X POST $API_URL \
126141
-H "Content-Type: application/json" \
127-
-H "Authorization: Bearer $OPENAI_API_KEY" \
128142
-d "$json_payload")
129143
130144
# Extract the summary from the response
131145
summary="$(echo $response | jq -r '.choices[0].message.content')"
132146
133147
# Print the summary
148+
# -H "Authorization: Bearer $API_KEY" \
134149
echo "Summary:"
135150
echo "$summary"
136151
echo "payload sent"
@@ -140,6 +155,7 @@ jobs:
140155
echo "$summary"
141156
echo EOF
142157
} >> "$GITHUB_OUTPUT"
158+
docker logs --tail 10 local-ai
143159
- uses: Eomm/why-don-t-you-tweet@v2
144160
with:
145161
tweet-message: ${{ steps.summarize.outputs.message }}

.github/workflows/notify-releases.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ 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"
14+
MODEL_NAME: gemma-3-12b-it-qat
1715
steps:
16+
- uses: mudler/localai-github-action@v1
17+
with:
18+
model: 'gemma-3-12b-it-qat' # Any from models.localai.io, or from huggingface.com with: "huggingface://<repository>/file"
1819
- name: Summarize
1920
id: summarize
2021
run: |
2122
input="$RELEASE_TITLE\b$RELEASE_BODY"
2223
24+
# Define the LocalAI API endpoint
25+
API_URL="http://localhost:8080/chat/completions"
26+
2327
# Create a JSON payload using jq to handle special characters
2428
json_payload=$(jq -n --arg input "$input" '{
25-
model: "'$OPENAI_MODEL'",
29+
model: "'$MODEL_NAME'",
2630
messages: [
2731
{
2832
role: "system",
@@ -35,16 +39,16 @@ jobs:
3539
]
3640
}')
3741
38-
# Send the request to OpenAI API
39-
response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \
42+
# Send the request to LocalAI API
43+
response=$(curl -s -X POST $API_URL \
4044
-H "Content-Type: application/json" \
41-
-H "Authorization: Bearer $OPENAI_API_KEY" \
4245
-d "$json_payload")
4346
4447
# Extract the summary from the response
4548
summary=$(echo $response | jq -r '.choices[0].message.content')
4649
4750
# Print the summary
51+
# -H "Authorization: Bearer $API_KEY" \
4852
{
4953
echo 'message<<EOF'
5054
echo "$summary"

0 commit comments

Comments
 (0)