Skip to content
Snippets Groups Projects
Select Git revision
  • a0a2db1bc013af48809b22f901b1a907f18bd6da
  • master default protected
  • renovate/m13253-dns-over-https-2.x
3 results

Dockerfile

Blame
  • check-existing.ts 1023 B
    import { logger } from '../../logger';
    import { RenovateConfig } from '../../config';
    import { platform } from '../../platform';
    import { REPOSITORY_CHANGED } from '../../constants/error-messages';
    
    /** TODO: Proper return type */
    export async function prAlreadyExisted(
      config: RenovateConfig
    ): Promise<any | null> {
      logger.trace({ config }, 'prAlreadyExisted');
      if (config.recreateClosed) {
        logger.debug('recreateClosed is true');
        return null;
      }
      logger.debug('recreateClosed is false');
      // Return if same PR already existed
      const pr = await platform.findPr({
        branchName: config.branchName,
        prTitle: config.prTitle,
        state: '!open',
      });
      if (pr) {
        logger.debug('Found closed PR with current title');
        const prDetails = await platform.getPr(pr.number);
        // istanbul ignore if
        if (prDetails.state === 'open') {
          logger.debug('PR reopened');
          throw new Error(REPOSITORY_CHANGED);
        }
        return pr;
      }
      logger.debug('prAlreadyExisted=false');
      return null;
    }