Skip to content

Commit

Permalink
Improve prompt for AI descriptions (#72)
Browse files Browse the repository at this point in the history
* Improve prompt for AI descriptions
* Use three-dots range and don't hardcode repository name
  • Loading branch information
lava authored Feb 11, 2025
1 parent 5ff0e77 commit d2caab3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/update-submodules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
env:
LOCATION: ${{ env.GEMINI_LOCATION }}
MODEL: ${{ env.GEMINI_MODEL }}
REPO: app
PROJECT_ID: ${{ steps.gcloud-login.outputs.project_id }}
GCLOUD_ACCESS_TOKEN: ${{ steps.gcloud-login.outputs.access_token }}
run: |
echo $PROJECT_ID
git submodule update --init --no-recommend-shallow components/app
current_sha=$(git -C components/app rev-parse HEAD)
current_sha_short=$(git -C components/app rev-parse --short HEAD)
Expand All @@ -97,6 +97,7 @@ jobs:
env:
LOCATION: ${{ env.GEMINI_LOCATION }}
MODEL: ${{ env.GEMINI_MODEL }}
REPO: event-horizon
PROJECT_ID: ${{ steps.gcloud-login.outputs.project_id }}
GCLOUD_ACCESS_TOKEN: ${{ steps.gcloud-login.outputs.access_token }}
run: |
Expand Down
14 changes: 12 additions & 2 deletions scripts/describe-component-bump
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ TO_COMMIT="$3"

CHANGELOG_BASE64=$(git -C ${SUBMODULE_PATH} log --stat ${FROM_COMMIT}..${TO_COMMIT} | base64 -w 0)

PROMPT=$(cat <<EOF
Please output a brief summary of the changes that were made in the attached git log.\n
Use roughly one sentence per independent feature or bugfix introduced.\n
Split the description into two parts, one for user-visible changes and one for purely internal refactorings, renaming, etc. If one of the parts would be empy, omit it completely.\n
If the changes correspond to exactly one identifiable GitHub PR, end the description with a link like this, where PR_NUMBER is replaced by the actual number:\n
\n
View PR: https://github.com/tenzir/${REPO}/pull/PR_NUMBER
EOF
)

REQUEST_JSON=$(cat <<EOF
{
"contents": {
"role": "user",
"parts": [
{"text": "Please output a brief summary of the changes that were made in the attached git log. Use roughly one sentence per independent feature or bugfix introduced. Focus on on the user-visible effect and not the technical implementation details."},
{"text": "${PROMPT}"},
{"inlineData": {"mimeType": "text/plain", "data": "${CHANGELOG_BASE64}"}},
],
}
Expand All @@ -34,4 +44,4 @@ if [ $? -eq 0 ]; then
else
echo $(git -C ${SUBMODULE_PATH} log --oneline --first-parent --no-decorate ${FROM_COMMIT}..${TO_COMMIT})
fi
echo "View Changes: https://github.com/tenzir/app/compare/${FROM_COMMIT}..${TO_COMMIT}"
echo "View Changes: https://github.com/tenzir/${REPO}/compare/${FROM_COMMIT}...${TO_COMMIT}"

0 comments on commit d2caab3

Please sign in to comment.