mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
* Initial plan * [AI] Make AI-generated release notes not run on release/ branches Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> * [AI] Use explicit startsWith(github.head_ref) if conditions instead of JS changes Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> * Delete extra condition * Add release notes for PR #7107 * [autofix.ci] apply automated fixes * FIx note * Add head branch information to PR details * Refactor conditions for release notes generation * Sec --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> Co-authored-by: Julian Dominguez-Schatz <julian.dominguezschatz@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
96 lines
4.7 KiB
YAML
96 lines
4.7 KiB
YAML
name: Generate Release Notes from CodeRabbit summary
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
generate-release-notes:
|
|
# Only run on PR comments from CodeRabbit bot
|
|
if: github.event.issue.pull_request && github.event.comment.user.login == 'coderabbitai[bot]'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
- name: Set up environment
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
download-translations: 'false'
|
|
|
|
- name: Check if this is CodeRabbit's first comment
|
|
id: check-first-comment
|
|
run: node .github/actions/ai-generated-release-notes/check-first-comment.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
|
|
|
|
- name: Get PR details
|
|
if: steps.check-first-comment.outputs.result == 'true'
|
|
id: pr-details
|
|
run: node .github/actions/ai-generated-release-notes/pr-details.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
|
|
- name: Check if release notes file already exists
|
|
if: >-
|
|
steps.check-first-comment.outputs.result == 'true' &&
|
|
steps.pr-details.outputs.result != 'null' &&
|
|
fromJSON(steps.pr-details.outputs.result).baseBranch == 'master' &&
|
|
!startsWith(fromJSON(steps.pr-details.outputs.result).headBranch, 'release/')
|
|
id: check-release-notes-exists
|
|
run: node .github/actions/ai-generated-release-notes/check-release-notes-exists.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
|
|
|
|
- name: Generate summary with OpenAI
|
|
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false'
|
|
id: generate-summary
|
|
run: node .github/actions/ai-generated-release-notes/generate-summary.js
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
GITHUB_EVENT_COMMENT_BODY: ${{ github.event.comment.body }}
|
|
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
|
|
|
|
- name: Determine category with OpenAI
|
|
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null'
|
|
id: determine-category
|
|
run: node .github/actions/ai-generated-release-notes/determine-category.js
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
GITHUB_EVENT_COMMENT_BODY: ${{ github.event.comment.body }}
|
|
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
|
|
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
|
|
|
|
- name: Create and commit release notes file via GitHub API
|
|
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null' && steps.determine-category.outputs.result != 'null' && steps.determine-category.outputs.result != ''
|
|
run: node .github/actions/ai-generated-release-notes/create-release-notes-file.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.ACTIONS_UPDATE_TOKEN }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
|
|
CATEGORY: ${{ steps.determine-category.outputs.result }}
|
|
|
|
- name: Comment on PR
|
|
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null' && steps.determine-category.outputs.result != 'null' && steps.determine-category.outputs.result != ''
|
|
run: node .github/actions/ai-generated-release-notes/comment-on-pr.js
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
|
|
CATEGORY: ${{ steps.determine-category.outputs.result }}
|