Skip to content

Commit 45ed032

Browse files
authored
Merge pull request #21 from bankrate/poem
2 parents 2228948 + d72fb2f commit 45ed032

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

.github/workflows/redrover_review.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ jobs:
3131
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3232
with:
3333
debug: true
34+
poem_enabled: true
35+
less_verbose_review: false
3436
review_comment_lgtm: false
3537
openai_heavy_model: gpt-4
3638
path_filters: |
3739
!dist/**
3840
!**/*.lock
39-
system_message: ${{ steps.file.outputs.content }}
40-
poem_enabled: true
41+
system_message: ${{ steps.file.outputs.content }}

action.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ inputs:
219219
220220
Avoid additional commentary as this summary will be added as a comment on the
221221
GitHub pull request. Use the titles "Walkthrough" and "Changes" and they must be H2.
222-
223222
summarize_release_notes:
224223
required: false
225224
description:
@@ -231,6 +230,19 @@ inputs:
231230
"Documentation", "Refactor", "Style", "Test", "Chore", or "Revert". Provide a bullet-point list,
232231
e.g., "- New Feature: Added search functionality to the UI". Limit your response to 50-100 words
233232
and emphasize features visible to the end-user while omitting code-level details.
233+
poem_enabled:
234+
required: false
235+
description: 'Enable the poem generation at the bottom of the full summary'
236+
default: 'false'
237+
poem:
238+
required: false
239+
description:
240+
'The prompt for generating the poem, only used if poem_enabled is true'
241+
default: |
242+
**Poem**: Below the changes, include a whimsical, short poem written by
243+
a dog to celebrate the changes. Format the poem as a quote using
244+
the ">" symbol and feel free to use emojis where relevant. Do not add
245+
extra lines breaks or <br> tags at the end of each poem line.
234246
language:
235247
required: false
236248
description: ISO code for the response language

src/main.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ async function run(): Promise<void> {
3838

3939
const prompts: Prompts = new Prompts(
4040
getInput('summarize'),
41-
getInput('summarize_release_notes')
41+
getInput('summarize_release_notes'),
42+
getBooleanInput('poem_enabled'),
43+
getInput('poem')
4244
)
4345

4446
// Create two bots, one for summary and one for review

src/prompts.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {type Inputs} from './inputs'
33
export class Prompts {
44
summarize: string
55
summarizeReleaseNotes: string
6+
poemEnabled: boolean
7+
poem: string
68

79
summarizeFileDiff = `## GitHub PR Title
810
@@ -259,9 +261,16 @@ $comment
259261
\`\`\`
260262
`
261263

262-
constructor(summarize = '', summarizeReleaseNotes = '') {
264+
constructor(
265+
summarize = '',
266+
summarizeReleaseNotes = '',
267+
poemEnabled = false,
268+
poem = ''
269+
) {
263270
this.summarize = summarize
264271
this.summarizeReleaseNotes = summarizeReleaseNotes
272+
this.poemEnabled = poemEnabled
273+
this.poem = poem
265274
}
266275

267276
renderSummarizeFileDiff(
@@ -284,7 +293,10 @@ $comment
284293
}
285294

286295
renderSummarize(inputs: Inputs): string {
287-
const prompt = this.summarizePrefix + this.summarize
296+
let prompt = this.summarizePrefix + this.summarize
297+
if (this.poemEnabled) {
298+
prompt += `\n ${this.poem}`
299+
}
288300
return inputs.render(prompt)
289301
}
290302

0 commit comments

Comments
 (0)