Skip to content
Snippets Groups Projects
Select Git revision
  • 9150854d7512f3de883843fd7c003e1e201f32fa
  • main default protected
  • fix/36615b-branch-reuse-no-cache
  • renovate/main-redis-5.x
  • next
  • revert-31645-feat/rename-gradle-wrapper-validation-action
  • chore/punycode
  • 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
  • fix/32307-global-extends-repositories
  • gh-readonly-queue/next/pr-35009-046ebf7cb84ab859f7fefceb5fa53a54ce9736f8
  • gh-readonly-queue/next/pr-35009-9d5e583b7d7251148ab0d11ee8dd38149618d162
  • 41.38.2
  • 41.38.1
  • 41.38.0
  • 41.37.12
  • 41.37.11
  • 41.37.10
  • 41.37.9
  • 41.37.8
  • 41.37.7
  • 41.37.6
  • 41.37.5
  • 41.37.4
  • 41.37.3
  • 41.37.2
  • 41.37.1
  • 41.37.0
  • 41.36.2
  • 41.36.1
  • 41.36.0
  • 41.35.2
41 results

error-config.ts

Blame
  • user avatar
    Rhys Arkins authored
    9150854d
    History
    error-config.ts 2.04 KiB
    import { getGlobalConfig } from '../../config/global';
    import type { RenovateConfig } from '../../config/types';
    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.validationSource) {
        body += `Location: \`${error.validationSource}\`\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 (getGlobalConfig().dryRun) {
          logger.info(`DRY-RUN: Would update PR #${pr.number}`);
        } else {
          try {
            await platform.updatePr({
              number: pr.number,
              prTitle: config.onboardingPrTitle,
              prBody: body,
            });
          } catch (err) /* istanbul ignore next */ {
            logger.warn({ err }, 'Error updating onboarding PR');
          }
        }
      } else if (getGlobalConfig().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');
        }
      }
    }