release-notes-prompt.py 1.2 KB

1234567891011121314151617181920212223
  1. """
  2. This script generates a base prompt for OpenAI to create release notes.
  3. """
  4. #!/usr/bin/env python3
  5. import os
  6. from datetime import datetime;
  7. from pytz import timezone
  8. GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT")
  9. TODAY = datetime.now(timezone('US/Eastern')).isoformat(sep=' ', timespec='seconds')
  10. BASE_PROMPT = f"""Based on the following 'PR Information', please generate concise and informative release notes to be read by developers.
  11. 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 if applicable, sections for '🚀 New Features & Improvements', '🐛 Bugs Fixed' and '🔧 Other Updates', with heading level 3, skip respectively the sections if not applicable.
  12. Finally include the following markdown comment with the PR merged date: <!-- PR_DATE: {TODAY} -->.
  13. Avoid being repetitive and focus on the most important changes and their impact, discard any mention of version bumps/updates, changeset files, environment variables or syntax updates.
  14. PR Information:"""
  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")