also looking at this
fix(gates): actually refresh the dashboard instead of reporting that it did
#1425
3 files
+86
-3
| @@ -82,7 +82,19 @@ export async function runPostMerge( | ||
| 82 | 82 | provider: GitProvider, |
| 83 | 83 | pr: PullRequest, |
| 84 | 84 | config: PostMergeConfig = {}, |
| 85 | options: { baseBranch?: string, logger?: Logger } = {}, | |
| 85 | options: { | |
| 86 | baseBranch?: string | |
| 87 | logger?: Logger | |
| 88 | /** | |
| 89 | * Refresh the dependency dashboard. | |
| 90 | * | |
| 91 | * A hook rather than something this module does, because refreshing means | |
| 92 | * a full scan and this file only knows about a provider. Absent means the | |
| 93 | * caller cannot refresh, which is reported as a skip rather than passed | |
| 94 | * off as done. | |
| 95 | */ | |
| 96 | refreshDashboard?: () => Promise<void> | |
| 97 | } = {}, | |
| 86 | 98 | ): Promise<PostMergeOutcome> { |
| 87 | 99 | const logger = options.logger ?? getDefaultLogger() |
| 88 | 100 | const baseBranch = options.baseBranch ?? pr.base ?? 'main' |
| @@ -138,8 +150,24 @@ export async function runPostMerge( | ||
| 138 | 150 | } |
| 139 | 151 | } |
| 140 | 152 | |
| 141 | if (config.refreshDashboard) | |
| 142 | performed.push('refresh-dashboard') | |
| 153 | if (config.refreshDashboard) { | |
| 154 | // This branch used to push `refresh-dashboard` onto `performed` and do | |
| 155 | // nothing at all — the one action here that reported success without | |
| 156 | // having any work behind it. | |
| 157 | if (!options.refreshDashboard) { | |
| 158 | skipped.push({ action: 'refresh-dashboard', reason: 'no dashboard refresher was supplied' }) | |
| 159 | } | |
| 160 | else { | |
| 161 | try { | |
| 162 | await options.refreshDashboard() | |
| 163 | performed.push('refresh-dashboard') | |
| 164 | } | |
| 165 | catch (error) { | |
| 166 | logger.warn(`⚠️ Could not refresh the dashboard: ${error}`) | |
| 167 | skipped.push({ action: 'refresh-dashboard', reason: 'refresh failed' }) | |
| 168 | } | |
| 169 | } | |
| 170 | } | |
| 143 | 171 | |
| 144 | 172 | return { performed, skipped } |
| 145 | 173 | } |