@@ -141,13 +141,6 @@ jobs:
141
141
# stage changes
142
142
git add -A
143
143
144
- - name : Read and format log
145
- run : |
146
- # Assuming the log file is located at ~/.local/share/gptme/logs/<conversation name>/conversation.jsonl
147
- while IFS= read -r line; do
148
- echo $(echo "$line" | jq -r '"\(.role): \(.content)"')
149
- done < ~/.local/share/gptme/logs/*/conversation.jsonl > log.txt
150
-
151
144
- name : Generate commit message
152
145
run : |
153
146
# generate commit message
@@ -164,23 +157,36 @@ jobs:
164
157
BRANCH_NAME : ${{ steps.checkout_branch.outputs.branch_name }}
165
158
BRANCH_BASE : " master"
166
159
run : |
160
+ # Read and format log
161
+ ./scripts/format_log.sh ~/.local/share/gptme/logs/*/conversation.jsonl > log.txt
162
+
167
163
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
168
164
COMMENT_URL="https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }}#issuecomment-${{ github.event.comment.id }}"
169
165
170
- COMMIT_MSG="\`gptme '$GPTME_COMMAND'\`
166
+ # commit message & description
167
+ COMMIT_MSG="$(cat message.txt || echo 'no commit message')"
168
+ COMMIT_DESC="\`gptme '$GPTME_COMMAND'\`
171
169
172
170
Triggered by: $COMMENT_URL
173
- Run: $RUN_URL
171
+ Run: $RUN_URL"
172
+
173
+ # commit message with description
174
+ COMMIT_MSG_FULL="$COMMIT_MSG
175
+
176
+ $COMMIT_DESC"
177
+
178
+ # commit message with description and log
179
+ COMMIT_MSG_FULL_WITH_LOG="$COMMIT_MSG_FULL
174
180
175
181
<details>
176
182
<summary>Log</summary>
177
- <pre>$(cat log.txt)</pre>
183
+ <pre>$(cat log.txt || echo 'could not get log' )</pre>
178
184
</details>"
179
185
180
186
git config user.name "gptme-bot"
181
187
git config user.email "[email protected] "
182
188
183
- git commit -m "$COMMIT_MSG "
189
+ git commit -m "$COMMIT_MSG_FULL "
184
190
185
191
# Push changes to the PR branch
186
192
git push -u origin $BRANCH_NAME
@@ -193,7 +199,7 @@ jobs:
193
199
sleep 1
194
200
195
201
# Create a PR
196
- PR_URL=$(gh pr create --title "Changes for issue #$ISSUE_NUMBER " --body "$COMMIT_MSG " --repo $USER_NAME/$REPO_NAME | grep -o 'https://github.com[^ ]*')
202
+ PR_URL=$(gh pr create --title "$COMMIT_MSG " --body "$COMMIT_MSG_FULL_WITH_LOG " --repo $USER_NAME/$REPO_NAME | grep -o 'https://github.com[^ ]*')
197
203
# These are redundant/implied: --base $BRANCH_BASE --head $USER_NAME:$BRANCH_NAME
198
204
199
205
# Comment on the issue with the PR link
0 commit comments