///
import got from 'got';
import Git from 'simple-git/promise';
import { RenovateConfig } from '../config/common';
import { BranchStatus } from '../types';
/**
* File to commit to branch
*/
export interface File {
/**
* Relative file path
*/
name: string;
/**
* file contents
*/
contents: string | Buffer;
}
export declare type CommitFilesConfig = {
branchName: string;
files: File[];
message: string;
parentBranch?: string;
createBranchBeforeCommit?: {
enabled: boolean;
extraPushOptions: object;
};
};
export interface GotApiOptions {
useCache?: boolean;
hostType?: string;
body?: any;
}
export declare type GotResponse = got.Response;
export interface GotApi {
get(url: string, options?: GotApiOptions & TOptions): Promise>;
post(url: string, options?: GotApiOptions & TOptions): Promise>;
put(url: string, options?: GotApiOptions & TOptions): Promise>;
patch(url: string, options?: GotApiOptions & TOptions): Promise>;
head(url: string, options?: GotApiOptions & TOptions): Promise>;
delete(url: string, options?: GotApiOptions & TOptions): Promise>;
reset(): void;
setBaseUrl(endpoint: string): void;
}
export interface PlatformConfig {
endpoint: string;
renovateUsername?: any;
gitAuthor?: any;
}
export interface RepoConfig {
baseBranch: string;
endpoint?: string;
renovateUsername?: any;
gitAuthor?: any;
isFork: boolean;
}
export interface RepoParams {
azureWorkItemId?: number;
bbUseDefaultReviewers?: boolean;
gitPrivateKey?: string;
localDir: string;
optimizeForDisabled: boolean;
repository: string;
endpoint?: string;
forkMode?: string;
forkToken?: string;
includeForks?: boolean;
renovateUsername?: string;
}
/**
* TODO: Proper typing
*/
export declare type Pr = {
branchName: string;
title: string;
state: string;
isConflicted?: boolean;
isModified?: boolean;
} & Record;
/**
* TODO: Proper typing
*/
export interface Issue {
body?: string;
number?: number;
state?: string;
title?: string;
}
export declare type PlatformPrOptions = {
azureAutoComplete?: boolean;
statusCheckVerify?: boolean;
gitLabAutomerge?: boolean;
};
export interface CreatePRConfig {
branchName: string;
prTitle: string;
prBody: string;
labels?: string[] | null;
useDefaultBranch?: boolean;
platformOptions?: PlatformPrOptions;
}
export interface EnsureIssueConfig {
title: string;
body: string;
once?: boolean;
shouldReOpen?: boolean;
}
export interface BranchStatusConfig {
branchName: string;
context: string;
description: string;
state: BranchStatus;
url?: string;
}
export interface FindPRConfig {
branchName: string;
prTitle?: string | null;
state?: 'open' | 'closed' | '!open' | 'all';
refreshCache?: boolean;
}
export interface EnsureCommentConfig {
number: number;
topic: string;
content: string;
}
/**
* TODO: Proper typing
*/
export declare type VulnerabilityAlert = any;
export declare type EnsureIssueResult = 'updated' | 'created';
export interface Platform {
findIssue(title: string): Promise;
getIssueList(): Promise;
getVulnerabilityAlerts(): Promise;
getCommitMessages(): Promise;
setBranchPrefix(branchPrefix: string): Promise;
initRepo(config: RepoParams): Promise;
cleanRepo(): Promise;
getPrFiles(prNo: number): Promise;
getPrList(): Promise;
getAllRenovateBranches(branchPrefix: string): Promise;
ensureIssueClosing(title: string): Promise;
getFileList(): Promise;
ensureIssue(issueConfig: EnsureIssueConfig): Promise;
getPrBody(prBody: string): string;
updatePr(number: number, prTitle: string, prBody?: string): Promise;
mergePr(number: number, branchName: string): Promise;
addReviewers(number: number, reviewers: string[]): Promise;
addAssignees(number: number, assignees: string[]): Promise;
createPr(prConfig: CreatePRConfig): Promise;
getBranchLastCommitTime(branchName: string): Promise;
getRepos(): Promise;
isBranchStale(branchName: string): Promise;
getRepoForceRebase(): Promise;
deleteLabel(number: number, label: string): Promise;
setBranchStatus(branchStatusConfig: BranchStatusConfig): Promise;
getBranchStatusCheck(branchName: string, context: string): Promise;
ensureCommentRemoval(number: number, subject: string): Promise;
deleteBranch(branchName: string, closePr?: boolean): Promise;
ensureComment(ensureComment: EnsureCommentConfig): Promise;
branchExists(branchName: string): Promise;
setBaseBranch(baseBranch?: string): Promise;
commitFilesToBranch(commitFile: CommitFilesConfig): Promise;
getPr(number: number): Promise;
findPr(findPRConfig: FindPRConfig): Promise;
mergeBranch(branchName: string): Promise;
getBranchStatus(branchName: string, requiredStatusChecks?: string[] | null): Promise;
getBranchPr(branchName: string): Promise;
getRepoStatus(): Promise;
getFile(lockFileName: string, branchName?: string): Promise;
initPlatform(config: RenovateConfig): Promise;
}