Select Git revision
index.js 31.10 KiB
const is = require('@sindresorhus/is');
const addrs = require('email-addresses');
const delay = require('delay');
const showdown = require('showdown');
const URL = require('url');
const get = require('./gh-got-wrapper');
const { expandError } = require('./util');
const endpoints = require('../../util/endpoints');
const Storage = require('./storage');
const GitStorage = require('../git/storage');
const converter = new showdown.Converter();
converter.setFlavor('github');
let config = {};
module.exports = {
// Initialization
getRepos,
cleanRepo,
initRepo,
getRepoForceRebase,
setBaseBranch,
// Search
getFileList,
// Branch
branchExists,
getAllRenovateBranches,
isBranchStale,
getBranchPr,
getBranchStatus,
getBranchStatusCheck,
setBranchStatus,
deleteBranch,
mergeBranch,
getBranchLastCommitTime,
// issue
ensureIssue,
ensureIssueClosing,
addAssignees,
addReviewers,
// Comments
ensureComment,
ensureCommentRemoval,
// PR
getPrList,
findPr,
createPr,
getPr,
getPrFiles,
updatePr,
mergePr,
getPrBody,
// file
commitFilesToBranch,
getFile,
// Commits
getCommitMessages,
// vulnerability alerts
getVulnerabilityAlerts,
};
// Get all repositories that the user has access to
async function getRepos(token, endpoint) {
logger.info('Autodiscovering GitHub repositories');
const opts = endpoints.find({ platform: 'github' }, { token, endpoint });
if (!opts.token) {
throw new Error('No token found for getRepos');
}