Skip to content
Snippets Groups Projects
Select Git revision
  • 93cc34f0f647a363463cec79c21c4d17e0e5e94e
  • main default protected
  • release-0.15
  • automated-updates-main
  • release-0.13
  • automated-updates-release-0.13
  • release-0.14
  • release-0.10
  • release-0.11
  • release-0.12
  • fix-versions-action
  • versions-fix
  • release-0.9
  • release-0.8
  • release-0.7
  • release-0.6
  • release-0.5
  • release-0.4
  • release-0.3
  • release-0.1
  • release-0.2
  • v0.15.0
  • v0.14.0
  • v0.13.0
  • v0.12.0
  • v0.11.0
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.0
  • v0.4.0
  • v0.3.0
  • v0.2.0
  • v0.1.0
36 results

test.sh

Blame
  • result.ts 1.22 KiB
    import { RenovateConfig } from '../../config';
    import {
      MANAGER_NO_PACKAGE_FILES,
      REPOSITORY_ACCESS_FORBIDDEN,
      REPOSITORY_ARCHIVED,
      REPOSITORY_BLOCKED,
      REPOSITORY_CANNOT_FORK,
      REPOSITORY_DISABLED,
      REPOSITORY_EMPTY,
      REPOSITORY_FORKED,
      REPOSITORY_MIRRORED,
      REPOSITORY_RENAMED,
      REPOSITORY_UNINITIATED,
    } from '../../constants/error-messages';
    
    type ProcessStatus = 'disabled' | 'enabled' | 'onboarding' | 'unknown';
    export interface ProcessResult {
      res: string;
      status: ProcessStatus;
    }
    
    export function processResult(
      config: RenovateConfig,
      res: string
    ): ProcessResult {
      const disabledStatuses = [
        REPOSITORY_ARCHIVED,
        REPOSITORY_BLOCKED,
        REPOSITORY_CANNOT_FORK,
        REPOSITORY_DISABLED,
        REPOSITORY_ACCESS_FORBIDDEN,
        REPOSITORY_FORKED,
        REPOSITORY_MIRRORED,
        MANAGER_NO_PACKAGE_FILES,
        REPOSITORY_RENAMED,
        REPOSITORY_UNINITIATED,
        REPOSITORY_EMPTY,
      ];
      let status: ProcessStatus;
      // istanbul ignore next
      if (disabledStatuses.includes(res)) {
        status = 'disabled';
      } else if (config.repoIsOnboarded) {
        status = 'enabled';
      } else if (config.repoIsOnboarded === false) {
        status = 'onboarding';
      } else {
        status = 'unknown';
      }
      return { res, status };
    }