Skip to content
Snippets Groups Projects
Select Git revision
  • 06abb5a5312dfaa1edac58cced94691e477c2ed7
  • master default protected
  • gh-pages
  • trunk
  • graphql-subscription
  • feat/1467/git-repo-path
  • board
  • I738207f8cb254b66f3ef18aa525fce39c71060e2
  • Ia1ad61e54e305bb073efc6853738d3eed81d576c
  • feat/lipgloss-formatting
  • bootstrap-rework-2
  • boostrap-rework
  • github-config-resilience
  • feat-849-terminal-output-in-core
  • gitea-bridge
  • feat-licences-checks
  • complete-comment
  • graphql-generics
  • fix/810-finish-reading-loop
  • gobilly
  • github-actions
  • v0.10.1
  • v0.10.0
  • v0.9.0
  • v0.8.1
  • v0.8.0
  • v0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
35 results

export.go

Blame
  • index.ts 2.56 KiB
    import { logger } from '../../../logger';
    import { mergeChildConfig, RenovateConfig } from '../../../config';
    import { extractAndUpdate, ExtractAndUpdateResult } from './extract-update';
    import { platform } from '../../../platform';
    import { WriteUpdateResult } from './write';
    import { BranchConfig } from '../../common';
    
    export async function processRepo(
      config: RenovateConfig
    ): Promise<ExtractAndUpdateResult> {
      logger.debug('processRepo()');
      /* eslint-disable no-param-reassign */
      config.masterIssueChecks = {};
      // istanbul ignore next
      if (
        config.masterIssue ||
        config.masterIssueApproval ||
        config.prCreation === 'approval' ||
        (config.packageRules &&
          config.packageRules.some(
            rule => rule.masterIssueApproval || rule.prCreation === 'approval'
          ))
      ) {
        config.masterIssueTitle =
          config.masterIssueTitle || `Update Dependencies (Renovate Bot)`;
        const issue = await platform.findIssue(config.masterIssueTitle);
        if (issue) {
          const checkMatch = ' - \\[x\\] <!-- ([a-zA-Z]+)-branch=([^\\s]+) -->';
          const checked = issue.body.match(new RegExp(checkMatch, 'g'));
          if (checked && checked.length) {
            const re = new RegExp(checkMatch);
            checked.forEach(check => {
              const [, type, branchName] = re.exec(check);
              config.masterIssueChecks[branchName] = type;
            });
          }
          const checkedRebaseAll = issue.body.includes(
            ' - [x] <!-- rebase-all-open-prs -->'
          );
          if (checkedRebaseAll) {
            config.masterIssueRebaseAllOpen = true;
            /* eslint-enable no-param-reassign */
          }
        }
      }
      if (config.baseBranches && config.baseBranches.length) {
        logger.debug({ baseBranches: config.baseBranches }, 'baseBranches');
        let res: WriteUpdateResult | undefined;
        let branches: BranchConfig[] = [];
        let branchList: string[] = [];
        for (const baseBranch of config.baseBranches) {
          logger.debug(`baseBranch: ${baseBranch}`);
          const baseBranchConfig = mergeChildConfig(config, { baseBranch });
          if (config.baseBranches.length > 1) {
            baseBranchConfig.branchPrefix += `${baseBranch}-`;
            baseBranchConfig.hasBaseBranches = true;
          }
          await platform.setBaseBranch(baseBranch);
          const baseBranchRes = await extractAndUpdate(baseBranchConfig);
          ({ res } = baseBranchRes);
          branches = branches.concat(baseBranchRes.branches);
          branchList = branchList.concat(baseBranchRes.branchList);
        }
        return { res, branches, branchList };
      }
      logger.debug('No baseBranches');
      return extractAndUpdate(config);
    }