UNPKG

backport

Version:

A CLI tool that automates the process of backporting commits

50 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMissingConfigFileException = exports.parseRemoteConfigFile = exports.RemoteConfigHistoryFragment = void 0; const generated_1 = require("../graphql/generated"); const readConfigFile_1 = require("../options/config/readConfigFile"); const logger_1 = require("./logger"); exports.RemoteConfigHistoryFragment = (0, generated_1.graphql)(` fragment RemoteConfigHistoryFragment on Commit { remoteConfigHistory: history(first: 1, path: ".backportrc.json") { edges { remoteConfig: node { committedDate file(path: ".backportrc.json") { ... on TreeEntry { __typename object { ... on Blob { __typename text } } } } } } } } `); function parseRemoteConfigFile(remoteConfig) { try { return (0, readConfigFile_1.parseConfigFile)(remoteConfig.file.object.text); } catch (e) { logger_1.logger.info('Parsing remote config failed', e); return; } } exports.parseRemoteConfigFile = parseRemoteConfigFile; function isMissingConfigFileException(result) { const data = result.data; const errors = (result.error?.graphQLErrors ?? []); const isMissingConfigError = errors.some((error) => { return (error.path?.includes('remoteConfig') && error.originalError?.type === 'NOT_FOUND'); }); const isMissingConfigFileException = isMissingConfigError && data != null; return isMissingConfigFileException; } exports.isMissingConfigFileException = isMissingConfigFileException; //# sourceMappingURL=remoteConfig.js.map