|
1 | 1 | import type { PackageInfo, ReleaseNote } from '../services/release-notes-fetcher'
|
2 |
| -import type { PullRequest, UpdateGroup } from '../types' |
| 2 | +import type { BuddyBotConfig, PullRequest, UpdateGroup } from '../types' |
3 | 3 | import { ReleaseNotesFetcher } from '../services/release-notes-fetcher'
|
4 | 4 |
|
5 | 5 | export class PullRequestGenerator {
|
6 | 6 | private releaseNotesFetcher = new ReleaseNotesFetcher()
|
7 | 7 |
|
| 8 | + constructor(private readonly config?: BuddyBotConfig) {} |
| 9 | + |
8 | 10 | /**
|
9 | 11 | * Generate pull requests for update groups
|
10 | 12 | */
|
@@ -451,7 +453,10 @@ export class PullRequestGenerator {
|
451 | 453 | // Add file reference with link to the dependency file
|
452 | 454 | if (update.file) {
|
453 | 455 | const fileName = update.file.split('/').pop() || update.file
|
454 |
| - body += `📁 **File**: [\`${fileName}\`](https://github.com/${this.config.repository.owner}/${this.config.repository.name}/blob/main/${update.file})\n\n` |
| 456 | + const fileCell = this.config?.repository?.owner && this.config?.repository?.name |
| 457 | + ? `📁 **File**: [\`${fileName}\`](https://github.com/${this.config.repository.owner}/${this.config.repository.name}/blob/main/${update.file})\n\n` |
| 458 | + : `📁 **File**: \`${fileName}\`\n\n` |
| 459 | + body += fileCell |
455 | 460 | }
|
456 | 461 |
|
457 | 462 | // Add appropriate links based on package type
|
@@ -533,9 +538,10 @@ export class PullRequestGenerator {
|
533 | 538 | body += `📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).\n\n`
|
534 | 539 | body += `🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\n\n`
|
535 | 540 | body += `♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.\n\n`
|
536 |
| - body += `🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.\n\n` |
| 541 | + const ignoreText = group.updates.length === 1 ? 'this update again' : 'these updates again' |
| 542 | + body += `🔕 **Ignore**: Close this PR and you won't be reminded about ${ignoreText}.\n\n` |
537 | 543 | body += `---\n\n`
|
538 |
| - body += ` - [ ] <!-- rebase-check -->If you want to update/retry this PR, check this box\n\n` |
| 544 | + body += ` - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box\n\n` |
539 | 545 | body += `---\n\n`
|
540 | 546 | body += `This PR was generated by [Buddy](https://github.com/stacksjs/buddy-bot) 🤖`
|
541 | 547 |
|
|
0 commit comments