import { CommitFilesConfig, LongCommitSha } from "../../util/git/types.js"; import { GithubVulnerabilityAlert } from "./github/schema.js"; import { BranchStatus } from "../../types/branch-status.js"; import { HostRule } from "../../types/host-rules.js"; import { MergeStrategy } from "../../config/types.js"; import { DateTime } from "luxon"; //#region lib/modules/platform/types.d.ts type VulnerabilityAlert = GithubVulnerabilityAlert; interface PlatformParams { endpoint?: string; token?: string; username?: string; password?: string; gitAuthor?: string; } interface PlatformResult { endpoint: string; renovateUsername?: string; token?: string; gitAuthor?: string; hostRules?: HostRule[]; } interface RepoResult { defaultBranch: string; isFork: boolean; repoFingerprint: string; } type GitUrlOption = 'default' | 'ssh' | 'endpoint'; interface RepoParams { repository: string; gitUrl?: GitUrlOption; forkCreation?: boolean; forkOrg?: string; forkToken?: string; forkProcessing?: 'enabled' | 'disabled'; renovateUsername?: string; cloneSubmodules?: boolean; cloneSubmodulesFilter?: string[]; } interface PrDebugData { createdInVer: string; updatedInVer: string; targetBranch: string; labels?: string[]; } interface PrBodyStruct { hash: string; rawConfigHash?: string; rebaseRequested?: boolean; debugData?: PrDebugData; } /** * */ interface Pr { bodyStruct?: PrBodyStruct; sourceBranch: string; cannotMergeReason?: string; createdAt?: string; closedAt?: string; hasAssignees?: boolean; labels?: string[]; number: number; reviewers?: string[]; sha?: LongCommitSha; sourceRepo?: string; state: string; targetBranch?: string; title: string; isDraft?: boolean; } /** * TODO: Proper typing */ interface Issue { body?: string; number?: number; state?: string; title?: string; } interface PlatformPrOptions { autoApprove?: boolean; automergeStrategy?: MergeStrategy; azureWorkItemId?: number; bbUseDefaultReviewers?: boolean; bbAutoResolvePrTasks?: boolean; gitLabIgnoreApprovals?: boolean; usePlatformAutomerge?: boolean; forkModeDisallowMaintainerEdits?: boolean; } interface CreatePRConfig { sourceBranch: string; targetBranch: string; prTitle: string; prBody: string; labels?: string[] | null; platformPrOptions?: PlatformPrOptions; draftPR?: boolean; milestone?: number; } interface UpdatePrConfig { number: number; platformPrOptions?: PlatformPrOptions; prTitle: string; prBody?: string; state?: 'open' | 'closed'; targetBranch?: string; /** * This field allows for label management and is designed to * accommodate the different label update methods on various platforms. * * - For Gitea, labels are updated by replacing the entire labels array. * - In the case of GitHub and GitLab, specific endpoints exist * for adding and removing labels. */ labels?: string[] | null; /** * Specifies an array of labels to be added. * @see {@link labels} */ addLabels?: string[] | null; /** * Specifies an array of labels to be removed. * @see {@link labels} */ removeLabels?: string[] | null; } interface ReattemptPlatformAutomergeConfig { number: number; platformPrOptions?: PlatformPrOptions; } interface EnsureIssueConfig { title: string; reuseTitle?: string; body: string; labels?: string[]; once?: boolean; shouldReOpen?: boolean; confidential?: boolean; } interface StatusCheckConfig { context: string; description: string; state: BranchStatus; url?: string; } interface BranchStatusConfig extends StatusCheckConfig { branchName: string; } interface FindPRConfig { branchName: string; prTitle?: string | null; state?: 'open' | 'closed' | '!open' | 'all'; refreshCache?: boolean; targetBranch?: string | null; includeOtherAuthors?: boolean; } interface MergePRConfig { branchName?: string; id: number; strategy?: MergeStrategy; } interface EnsureCommentConfig { number: number; topic: string | null; content: string; } interface EnsureCommentRemovalConfigByTopic { type: 'by-topic'; number: number; topic: string; } interface EnsureCommentRemovalConfigByContent { type: 'by-content'; number: number; content: string; } type EnsureCommentRemovalConfig = EnsureCommentRemovalConfigByTopic | EnsureCommentRemovalConfigByContent; type EnsureIssueResult = 'updated' | 'created'; type RepoSortMethod = 'alpha' | 'created' | 'created_at' | 'updated' | 'updated_at' | 'size' | 'id' | null; type SortMethod = 'asc' | 'desc' | null; interface AutodiscoverConfig { topics?: string[]; sort?: RepoSortMethod; order?: SortMethod; includeMirrors?: boolean; namespaces?: string[]; projects?: string[]; } interface FileOwnerRule { usernames: string[]; pattern: string; score: number; match: (path: string) => boolean; } interface Platform { /** * Whether this is an experimental Platform. * * Experimental features might be changed or even removed at any time. */ experimental?: true; findIssue(title: string): Promise; getIssueList(): Promise; getIssue?(number: number, memCache?: boolean): Promise; getVulnerabilityAlerts?(): Promise; getRawFile(fileName: string, repoName?: string, branchOrTag?: string): Promise; getJsonFile(fileName: string, repoName?: string, branchOrTag?: string): Promise; initRepo(config: RepoParams): Promise; getPrList(): Promise; ensureIssueClosing(title: string): Promise; ensureIssue(issueConfig: EnsureIssueConfig): Promise; massageMarkdown(prBody: string, /** * Useful for suggesting the use of rebase label when there is no better * way, e.g. for Gerrit. */ rebaseLabel?: string): string; updatePr(prConfig: UpdatePrConfig): Promise; mergePr(config: MergePRConfig): Promise; addReviewers(number: number, reviewers: string[]): Promise; addAssignees(number: number, assignees: string[]): Promise; createPr(prConfig: CreatePRConfig): Promise; getRepos(config?: AutodiscoverConfig): Promise; getBranchForceRebase?(branchName: string): Promise; deleteLabel(number: number, label: string): Promise; addLabel?(number: number, label: string): Promise; setBranchStatus(branchStatusConfig: BranchStatusConfig): Promise; getBranchStatusCheck(branchName: string, context: string | null | undefined): Promise; ensureCommentRemoval(ensureCommentRemoval: EnsureCommentRemovalConfigByTopic | EnsureCommentRemovalConfigByContent): Promise; ensureComment(ensureComment: EnsureCommentConfig): Promise; getPr(number: number): Promise; findPr(findPRConfig: FindPRConfig): Promise; refreshPr?(number: number): Promise; reattemptPlatformAutomerge?(prConfig: ReattemptPlatformAutomergeConfig): Promise; getBranchStatus(branchName: string, internalChecksAsSuccess: boolean): Promise; /** * Get the PR for a given branch. * * @param branchName The source branch name * @param targetBranch Optional target branch to prioritize when multiple PRs exist for the * same source branch. * * This does not restrict results to PRs targeting this branch. Instead, if * more than one PR matches the given source branch, the one whose target * branch matches `targetBranch` will be preferred. * * Only used by Azure and Gerrit platforms currently. * @returns The PR object if found, otherwise null. */ getBranchPr(branchName: string, targetBranch?: string): Promise; tryReuseAutoclosedPr?(pr: Pr, newTitle: string): Promise; initPlatform(config: PlatformParams): Promise; filterUnavailableUsers?(users: string[]): Promise; commitFiles?(config: CommitFilesConfig): Promise; expandGroupMembers?(reviewersOrAssignees: string[]): Promise; extractRulesFromCodeOwnersLines?(cleanedLines: string[]): FileOwnerRule[]; maxBodyLength(): number; labelCharLimit?(): number; } interface PlatformScm { isBranchBehindBase(branchName: string, baseBranch: string): Promise; isBranchModified(branchName: string, baseBranch: string): Promise; isBranchConflicted(baseBranch: string, branch: string): Promise; branchExists(branchName: string): Promise; getBranchCommit(branchName: string): Promise; getBranchUpdateDate(branchName: string): Promise; deleteBranch(branchName: string): Promise; commitAndPush(commitConfig: CommitFilesConfig): Promise; getFileList(): Promise; checkoutBranch(branchName: string): Promise; mergeToLocal(branchName: string): Promise; mergeAndPush(branchName: string): Promise; syncForkWithUpstream?(baseBranch: string): Promise; } //#endregion export { AutodiscoverConfig, BranchStatusConfig, CreatePRConfig, EnsureCommentConfig, EnsureCommentRemovalConfig, EnsureCommentRemovalConfigByContent, EnsureCommentRemovalConfigByTopic, EnsureIssueConfig, EnsureIssueResult, FileOwnerRule, FindPRConfig, GitUrlOption, Issue, MergePRConfig, Platform, PlatformParams, PlatformPrOptions, PlatformResult, PlatformScm, Pr, PrBodyStruct, PrDebugData, ReattemptPlatformAutomergeConfig, RepoParams, RepoResult, RepoSortMethod, SortMethod, StatusCheckConfig, UpdatePrConfig, VulnerabilityAlert }; //# sourceMappingURL=types.d.ts.map