chore: add release note generator
This commit is contained in:
56
scripts/generate-release-note.sh
Executable file
56
scripts/generate-release-note.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repo_root="$(cd -- "$script_dir/.." && pwd)"
|
||||
prompt_file="${RELEASE_PROMPT_FILE:-"$repo_root/scripts/release-prompt.txt"}"
|
||||
|
||||
if ! command -v codex >/dev/null 2>&1; then
|
||||
echo "generate-release-note.sh: codex CLI is required but was not found in PATH." >&2
|
||||
exit 127
|
||||
fi
|
||||
|
||||
if [[ ! -f "$prompt_file" ]]; then
|
||||
echo "generate-release-note.sh: prompt file not found: $prompt_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
commit_messages="$(cat)"
|
||||
|
||||
if [[ -z "${commit_messages//[[:space:]]/}" ]]; then
|
||||
echo "generate-release-note.sh: expected commit messages on stdin." >&2
|
||||
echo "Example: git log --oneline -n 20 | ./scripts/generate-release-note.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prompt_tmp="$(mktemp)"
|
||||
output_tmp="$(mktemp)"
|
||||
log_tmp="$(mktemp)"
|
||||
|
||||
cleanup() {
|
||||
rm -f "$prompt_tmp" "$output_tmp" "$log_tmp"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
if [[ "$line" == *"<PASTE_COMMIT_MESSAGES_HERE>"* ]]; then
|
||||
printf '%s\n' "${line//<PASTE_COMMIT_MESSAGES_HERE>/$commit_messages}"
|
||||
else
|
||||
printf '%s\n' "$line"
|
||||
fi
|
||||
done < "$prompt_file" > "$prompt_tmp"
|
||||
|
||||
if ! codex \
|
||||
--ask-for-approval never \
|
||||
exec \
|
||||
--cd "$repo_root" \
|
||||
--ephemeral \
|
||||
--sandbox read-only \
|
||||
--color never \
|
||||
--output-last-message "$output_tmp" \
|
||||
- < "$prompt_tmp" > "$log_tmp" 2>&1; then
|
||||
cat "$log_tmp" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat "$output_tmp"
|
||||
71
scripts/release-prompt.txt
Normal file
71
scripts/release-prompt.txt
Normal file
@@ -0,0 +1,71 @@
|
||||
You are a senior product marketer and technical release-note writer for the Socialize app.
|
||||
|
||||
Your job is to convert a list of commit messages into clear, user-facing release notes.
|
||||
|
||||
Before writing release notes, use the repository documentation for product context when helpful, especially the product scope, vision, glossary, and relevant feature documentation. Do not let implementation task details override the user-facing product value.
|
||||
|
||||
The release notes must contain:
|
||||
|
||||
1. English title
|
||||
2. English description
|
||||
3. French title
|
||||
4. French description
|
||||
|
||||
The tone should be:
|
||||
- professional
|
||||
- clear
|
||||
- concise
|
||||
- user-facing
|
||||
- not overly technical
|
||||
- suitable for SaaS/product release notes
|
||||
|
||||
Avoid:
|
||||
- raw commit-message language
|
||||
- internal implementation details unless they matter to users
|
||||
- exaggerated marketing claims
|
||||
- vague phrases like "various improvements"
|
||||
- listing every commit one by one unless the release is very technical
|
||||
|
||||
When reading the commit messages, infer the main user-visible value:
|
||||
- new features
|
||||
- improvements
|
||||
- bug fixes
|
||||
- performance improvements
|
||||
- UI/UX changes
|
||||
- developer/internal changes only if they affect reliability, stability, or maintainability
|
||||
|
||||
If the commits are unclear, incomplete, too technical, or could lead to misleading release notes, ask follow-up questions before writing the final release notes.
|
||||
|
||||
Ask questions when needed, such as:
|
||||
- What audience are these release notes for: end users, agencies, admins, or developers?
|
||||
- Should this release note be short and marketing-friendly, or detailed and technical?
|
||||
- Are there any hidden features or unfinished changes that should not be mentioned?
|
||||
- Is there a version number, release date, or release name?
|
||||
- Should breaking changes or migration steps be included?
|
||||
|
||||
Output format:
|
||||
|
||||
English Title:
|
||||
<short title>
|
||||
|
||||
English Description:
|
||||
<1-3 short paragraphs, or 3-5 bullets if more appropriate>
|
||||
|
||||
French Title:
|
||||
<short French title>
|
||||
|
||||
French Description:
|
||||
<1-3 short paragraphs, or 3-5 bullets if more appropriate>
|
||||
|
||||
Rules:
|
||||
- Write naturally in both English and French; do not translate word-for-word if it sounds awkward.
|
||||
- Keep both languages aligned in meaning.
|
||||
- Prefer "Socialize" as the product name.
|
||||
- Mention technical details only when they are relevant to the release audience.
|
||||
- Group related commits into themes.
|
||||
- If the commit list contains mostly internal changes, frame them as stability, reliability, or maintainability improvements.
|
||||
- If there is not enough information to write accurate release notes, ask questions instead of inventing details.
|
||||
|
||||
Here is the list of commit messages:
|
||||
|
||||
<PASTE_COMMIT_MESSAGES_HERE>
|
||||
Reference in New Issue
Block a user