Skip to content
Snippets Groups Projects
Select Git revision
  • 7a25491a49a7f240956decf84c0bcf4bcc7c51f3
  • main default protected
  • renovate/main-ghcr.io-renovatebot-base-image-10.x
  • renovate/main-ghcr.io-containerbase-devcontainer-13.x
  • next
  • revert-31645-feat/rename-gradle-wrapper-validation-action
  • renovate/main-redis-5.x
  • fix/36615b-branch-reuse-no-cache
  • chore/punycode
  • fix/36615-branch-reuse-bug
  • refactor/pin-new-value
  • feat/36219--git-x509-signing
  • feat/structured-logger
  • hotfix/39.264.1
  • feat/skip-dangling
  • gh-readonly-queue/next/pr-36034-7a061c4ca1024a19e2c295d773d9642625d1c2be
  • hotfix/39.238.3
  • refactor/gitlab-auto-approve
  • feat/template-strings
  • gh-readonly-queue/next/pr-35654-137d934242c784e0c45d4b957362214f0eade1d7
  • fix/32307-global-extends-merging
  • 41.31.1
  • 41.31.0
  • 41.30.5
  • 41.30.4
  • 41.30.3
  • 41.30.2
  • 41.30.1
  • 41.30.0
  • 41.29.1
  • 41.29.0
  • 41.28.2
  • 41.28.1
  • 41.28.0
  • 41.27.1
  • 41.27.0
  • 41.26.2
  • 41.26.1
  • 41.26.0
  • 41.25.1
  • 41.25.0
41 results

error-config.ts

Blame
  • user avatar
    Michael Kriese authored and GitHub committed
    * fix: wrong code quoting
    
    * fix: can be undefined
    
    * fix: wrong function
    7a25491a
    History
    error-config.ts 1.81 KiB
    import { RenovateConfig } from '../../config';
    import { logger } from '../../logger';
    import { platform } from '../../platform';
    import { PrState } from '../../types';
    
    export async function raiseConfigWarningIssue(
      config: RenovateConfig,
      error: Error
    ): Promise<void> {
      logger.debug('raiseConfigWarningIssue()');
      let body = `There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.\n\n`;
      if (error.configFile) {
        body += `File: \`${error.configFile}\`\n`;
      }
      body += `Error type: ${error.validationError}\n`;
      if (error.validationMessage) {
        body += `Message: \`${error.validationMessage.replace(/`/g, "'")}\`\n`;
      }
      const pr = await platform.getBranchPr(config.onboardingBranch);
      if (pr?.state === PrState.Open) {
        logger.debug('Updating onboarding PR with config error notice');
        body = `## Action Required: Fix Renovate Configuration\n\n${body}`;
        body += `\n\nOnce you have resolved this problem (in this onboarding branch), Renovate will return to providing you with a preview of your repository's configuration.`;
        if (config.dryRun) {
          logger.info(`DRY-RUN: Would update PR #${pr.number}`);
        } else {
          await platform.updatePr({
            number: pr.number,
            prTitle: config.onboardingPrTitle,
            prBody: body,
          });
        }
      } else if (config.dryRun) {
        logger.info('DRY-RUN: Would ensure config error issue');
      } else {
        const once = false;
        const shouldReopen = config.configWarningReuseIssue;
        const res = await platform.ensureIssue({
          title: `Action Required: Fix Renovate Configuration`,
          body,
          once,
          shouldReOpen: shouldReopen,
        });
        if (res === 'created') {
          logger.warn({ configError: error, res }, 'Config Warning');
        }
      }
    }