Skip to content

Commit 2b8e85a

Browse files
committed
Making base prompt visible
1 parent eb1c18c commit 2b8e85a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
from datetime import datetime;
3+
from pytz import timezone
4+
5+
GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT")
6+
7+
TODAY = datetime.now(timezone('US/Eastern')).isoformat(sep=' ', timespec='seconds')
8+
9+
BASE_PROMPT = f"""Based on the following 'PR Information', please generate a concise and informative release notes to be read by developers.
10+
Format the release notes with markdown, and always use this structure: a descriptive and very short title (no more than 8 words) with heading level 2, a paragraph with a summary of changes (no header), and sections for '🚀 New Features & Improvements', '🐛 Bugs Fixed' and '🔧 Other Updates', with heading level 3, skip respectively the sections if not applicable.
11+
Finally include the following markdown comment with the PR merged date: <!-- PR_DATE: {TODAY} -->.
12+
Avoid being repetitive and focus on the most important changes and their impact, don't mention version bumps, nor changeset files, nor environment variables, nor syntax updates.
13+
PR Information:"""
14+
15+
# Write the prompt to GITHUB_OUTPUT
16+
with open(GITHUB_OUTPUT, "a") as outputs_file:
17+
outputs_file.write(f"BASE_PROMPT<<EOF\n{BASE_PROMPT}\nEOF")

.github/workflows/changeset-ai-releases.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ jobs:
8585
echo "version=$VERSION"
8686
echo "prev_version=$PREV_VERSION"
8787
88+
- name: Release Notes Prompt
89+
id: ai_prompt
90+
run: |
91+
# Get today's date in YYYY-MM-DD format
92+
TODAY=$(date +'%Y-%m-%d %H:%M')
93+
94+
echo "BASE_PROMPT<<EOF" >> $GITHUB_OUTPUT
95+
echo "Based on the following 'PR Information', please generate concise and informative release notes to be read by developers.
96+
97+
Format the release notes with markdown, and always use this structure: a descriptive and very short title (no more than 8 words) with heading level 2, a paragraph with a summary of changes (no header), and sections for '🚀 New Features & Improvements', '🐛 Bugs Fixed' and '🔧 Other Updates', with heading level 3, skip respectively the sections if not applicable,
98+
finally include the following markdown comment with the PR merged date: <!-- PR_DATE: $TODAY -->.
99+
100+
Avoid being repetitive and focus on the most important changes and their impact, don't mention version bumps, nor changeset files, nor environment variables, nor syntax updates.
101+
102+
PR Information:" >> $GITHUB_OUTPUT
103+
echo "EOF" >> $GITHUB_OUTPUT
104+
88105
# Github outputs: 'RELEASE_NOTES' and 'OPENAI_PROMPT'
89106
- name: AI Release Notes
90107
if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}
@@ -96,6 +113,7 @@ jobs:
96113
model_name: gpt-4o-mini
97114
repo_path: ${{ env.REPO_PATH }}
98115
git_ref: ${{ env.GIT_REF }}
116+
custom_prompt: ${{ steps.ai_prompt.outputs.BASE_PROMPT }}
99117

100118
- name: Update Changeset Changelog
101119
if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}

0 commit comments

Comments
 (0)