import { Repository } from './repository'; import { Commit } from './commit'; import { PullRequest } from './pull-request'; import { ReleasePullRequest } from './release-pull-request'; import { Update } from './update'; import { Release } from './release'; import { GitHubFileContents } from '@google-automations/git-file-utils'; import { PullRequestOverflowHandler } from './util/pull-request-overflow-handler'; export interface ScmFileDiff { readonly mode: '100644' | '100755' | '040000' | '160000' | '120000'; readonly content: string | null; readonly originalContent: string | null; } export type ScmChangeSet = Map; export interface ScmCommitIteratorOptions { maxResults?: number; backfillFiles?: boolean; batchSize?: number; } export interface ScmReleaseIteratorOptions { maxResults?: number; } export interface ScmTagIteratorOptions { maxResults?: number; } export interface ScmCreatePullRequestOptions { fork?: boolean; draft?: boolean; } export interface ScmUpdatePullRequestOptions { signoffUser?: string; fork?: boolean; pullRequestOverflowHandler?: PullRequestOverflowHandler; } export interface ScmReleaseOptions { draft?: boolean; prerelease?: boolean; forceTag?: boolean; } export interface ScmRelease { id: number; name?: string; tagName: string; sha: string; notes?: string; url: string; draft?: boolean; uploadUrl?: string; } export interface ScmTag { name: string; sha: string; } export interface Scm { readonly repository: Repository; getFileContents(path: string): Promise; getFileContentsOnBranch(path: string, branch: string): Promise; getFileJson(path: string, branch: string): Promise; findFilesByFilename(filename: string, prefix?: string): Promise; findFilesByFilenameAndRef(filename: string, ref: string, prefix?: string): Promise; findFilesByGlob(glob: string, prefix?: string): Promise; findFilesByGlobAndRef(glob: string, ref: string, prefix?: string): Promise; findFilesByExtension(extension: string, prefix?: string): Promise; findFilesByExtensionAndRef(extension: string, ref: string, prefix?: string): Promise; commitsSince(targetBranch: string, filter: (commit: Commit) => boolean, options?: ScmCommitIteratorOptions): Promise; mergeCommitIterator(targetBranch: string, options?: ScmCommitIteratorOptions): AsyncGenerator; pullRequestIterator(targetBranch: string, status?: 'OPEN' | 'CLOSED' | 'MERGED', maxResults?: number, includeFiles?: boolean): AsyncGenerator; releaseIterator(options?: ScmReleaseIteratorOptions): AsyncGenerator; tagIterator(options?: ScmTagIteratorOptions): AsyncGenerator; createPullRequest(pullRequest: PullRequest, targetBranch: string, message: string, updates: Update[], options?: ScmCreatePullRequestOptions): Promise; updatePullRequest(number: number, pullRequest: ReleasePullRequest, targetBranch: string, options?: ScmUpdatePullRequestOptions): Promise; getPullRequest(number: number): Promise; createRelease(release: Release, options?: ScmReleaseOptions): Promise; commentOnIssue(comment: string, number: number): Promise; removeIssueLabels(labels: string[], number: number): Promise; addIssueLabels(labels: string[], number: number): Promise; generateReleaseNotes(tagName: string, targetCommitish: string, previousTag?: string): Promise; createFileOnNewBranch(filename: string, contents: string, newBranchName: string, baseBranchName: string): Promise; buildChangeSet(updates: Update[], defaultBranch: string): Promise; }