mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-25 21:49:39 +00:00
fix: update workflow name and enhance commit message handling in AI PR Description
This commit is contained in:
13
.github/workflows/pr-description.yml
vendored
13
.github/workflows/pr-description.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: 🤖 AI PR Description Commenter (With Debug)
|
||||
name: 🤖 AI PR Description Commenter (Safe JSON with PAT)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@ -12,10 +12,10 @@ jobs:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install GitHub CLI
|
||||
- name: Install GitHub CLI and jq
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gh -y
|
||||
sudo apt-get install gh jq -y
|
||||
|
||||
- name: Fetch PR Commits
|
||||
id: fetch_commits
|
||||
@ -27,9 +27,10 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Generate PR Description with OpenAI
|
||||
id: generate_description
|
||||
- name: Generate PR Description with OpenAI (Safe JSON)
|
||||
run: |
|
||||
ESCAPED_COMMITS=$(printf '%s\n' "${commits}" | jq -R . | jq -s -c 'join("\n")')
|
||||
|
||||
RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
@ -37,7 +38,7 @@ jobs:
|
||||
"model": "gpt-4o",
|
||||
"messages": [{
|
||||
"role": "user",
|
||||
"content": "Given the following commit messages:\n\n'"${commits}"'\n\nGenerate a clear and professional pull request description."
|
||||
"content": "Given the following commit messages:\n\n'"${ESCAPED_COMMITS}"'\n\nGenerate a clear and professional pull request description."
|
||||
}]
|
||||
}')
|
||||
|
||||
|
Reference in New Issue
Block a user