()
| 51 | } |
| 52 | |
| 53 | async routineCheck(): Promise<void> { |
| 54 | this.logger.info( |
| 55 | { config: this.config }, |
| 56 | `Routine Check - ${pluralize("rule", this.config.rules.length, true)}`, |
| 57 | ); |
| 58 | |
| 59 | for (const rule of this.config.rules) { |
| 60 | this.logger.debug({ rule }, `Routine Check for rule`); |
| 61 | const { base, upstream, assignees, reviewers } = rule; |
| 62 | const normalizedBase = base.toLowerCase(); |
| 63 | const normalizedUpstream = upstream.toLowerCase().replace( |
| 64 | `${this.owner.toLowerCase()}:`, |
| 65 | "", |
| 66 | ); |
| 67 | |
| 68 | if (normalizedBase === normalizedUpstream) { |
| 69 | this.logger.debug( |
| 70 | `${base} is same as ${upstream}`, |
| 71 | ); |
| 72 | continue; |
| 73 | } |
| 74 | |
| 75 | if (!(await this.hasDiff(base, upstream))) { |
| 76 | this.logger.debug( |
| 77 | `${base} is in sync with ${upstream}`, |
| 78 | ); |
| 79 | continue; |
| 80 | } |
| 81 | |
| 82 | const openPR = await this.getOpenPR(base, upstream); |
| 83 | if (openPR) { |
| 84 | this.logger.debug( |
| 85 | `Found a PR from ${upstream} to ${base}`, |
| 86 | ); |
| 87 | await this.checkAutoMerge(openPR); |
| 88 | } else { |
| 89 | this.logger.info( |
| 90 | `Creating PR from ${upstream} to ${base}`, |
| 91 | ); |
| 92 | const newPR = await this.createPR(base, upstream, assignees, reviewers); |
| 93 | await this.checkAutoMerge(newPR); |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | private async checkAutoMerge( |
| 99 | incomingPR: PullRequestData | null, |
no test coverage detected