Skip to content
Snippets Groups Projects
Select Git revision
  • 1392955a04b6a18ac70eea9b59f627caaaae3022
  • main default protected
  • renovate/main-zod-3.x
  • 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
  • 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.24.0
  • 41.23.5
  • 41.23.4
  • 41.23.3
  • 41.23.2
  • 41.23.1
  • 41.23.0
  • 41.22.0
  • 41.21.4
  • 41.21.3
41 results

handle-existing.ts

Blame
  • user avatar
    Rhys Arkins authored
    227f9f73
    History
    handle-existing.ts 2.30 KiB
    import { getAdminConfig } from '../../config/admin';
    import { logger } from '../../logger';
    import { Pr, platform } from '../../platform';
    import { PrState } from '../../types';
    import { branchExists, deleteBranch } from '../../util/git';
    import { BranchConfig } from '../types';
    
    export async function handlepr(config: BranchConfig, pr: Pr): Promise<void> {
      if (pr.state === PrState.Closed) {
        let content;
        if (config.updateType === 'major') {
          content = `As this PR has been closed unmerged, Renovate will ignore this upgrade and you will not receive PRs for *any* future ${config.newMajor}.x releases. However, if you upgrade to ${config.newMajor}.x manually then Renovate will then reenable updates for minor and patch updates automatically.`;
        } else if (config.updateType === 'digest') {
          content = `As this PR has been closed unmerged, Renovate will ignore this upgrade updateType and you will not receive PRs for *any* future ${config.depName}:${config.currentValue} digest updates. Digest updates will resume if you update the specified tag at any time.`;
        } else {
          content = `As this PR has been closed unmerged, Renovate will now ignore this update (${config.newValue}). You will still receive a PR once a newer version is released, so if you wish to permanently ignore this dependency, please add it to the \`ignoreDeps\` array of your renovate config.`;
        }
        content +=
          '\n\nIf this PR was closed by mistake or you changed your mind, you can simply rename this PR and you will soon get a fresh replacement PR opened.';
        if (!config.suppressNotifications.includes('prIgnoreNotification')) {
          const ignoreTopic = `Renovate Ignore Notification`;
          if (getAdminConfig().dryRun) {
            logger.info(
              `DRY-RUN: Would ensure closed PR comment in PR #${pr.number}`
            );
          } else {
            await platform.ensureComment({
              number: pr.number,
              topic: ignoreTopic,
              content,
            });
          }
        }
        if (branchExists(config.branchName)) {
          if (getAdminConfig().dryRun) {
            logger.info('DRY-RUN: Would delete branch ' + config.branchName);
          } else {
            await deleteBranch(config.branchName);
          }
        }
      } else if (pr.state === PrState.Merged) {
        logger.debug({ pr: pr.number }, 'Merged PR is blocking this branch');
      }
    }