mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-29 20:43:37 +03:00
fix: createPr
arguments order (#4878)
This commit is contained in:
parent
25c2f516fd
commit
a1ff2079db
@ -126,7 +126,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
await $prService.createPr(title, body, opts.draft, upstreamBranchName, baseBranchName);
|
||||
await $prService.createPr({
|
||||
title,
|
||||
body,
|
||||
draft: opts.draft,
|
||||
baseBranchName,
|
||||
upstreamName: upstreamBranchName
|
||||
});
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
const toast = mapErrorToToast(err);
|
||||
|
@ -8,7 +8,12 @@ import { get, writable } from 'svelte/store';
|
||||
import type { Persisted } from '$lib/persisted/persisted';
|
||||
import type { RepoInfo } from '$lib/url/gitUrl';
|
||||
import type { GitHostPrService } from '../interface/gitHostPrService';
|
||||
import type { DetailedPullRequest, MergeMethod, PullRequest } from '../interface/types';
|
||||
import type {
|
||||
CreatePullRequestArgs,
|
||||
DetailedPullRequest,
|
||||
MergeMethod,
|
||||
PullRequest
|
||||
} from '../interface/types';
|
||||
import type { Octokit } from '@octokit/rest';
|
||||
|
||||
const DEFAULT_PULL_REQUEST_TEMPLATE_PATH = '.github/PULL_REQUEST_TEMPLATE.md';
|
||||
@ -23,13 +28,13 @@ export class GitHubPrService implements GitHostPrService {
|
||||
private pullRequestTemplatePath?: Persisted<string>
|
||||
) {}
|
||||
|
||||
async createPr(
|
||||
title: string,
|
||||
body: string,
|
||||
draft: boolean,
|
||||
baseBranchName: string,
|
||||
upstreamName: string
|
||||
): Promise<PullRequest> {
|
||||
async createPr({
|
||||
title,
|
||||
body,
|
||||
draft,
|
||||
baseBranchName,
|
||||
upstreamName
|
||||
}: CreatePullRequestArgs): Promise<PullRequest> {
|
||||
this.loading.set(true);
|
||||
const request = async (pullRequestTemplate: string | undefined = '') => {
|
||||
const resp = await this.octokit.rest.pulls.create({
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { buildContextStore } from '$lib/utils/context';
|
||||
import type { GitHostPrMonitor } from './gitHostPrMonitor';
|
||||
import type { DetailedPullRequest, MergeMethod, PullRequest } from './types';
|
||||
import type { CreatePullRequestArgs, DetailedPullRequest, MergeMethod, PullRequest } from './types';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
export const [getGitHostPrService, createGitHostPrServiceStore] = buildContextStore<
|
||||
@ -10,13 +10,13 @@ export const [getGitHostPrService, createGitHostPrServiceStore] = buildContextSt
|
||||
export interface GitHostPrService {
|
||||
loading: Writable<boolean>;
|
||||
get(prNumber: number): Promise<DetailedPullRequest>;
|
||||
createPr(
|
||||
title: string,
|
||||
body: string,
|
||||
draft: boolean,
|
||||
baseBranchName: string,
|
||||
upstreamName: string
|
||||
): Promise<PullRequest>;
|
||||
createPr({
|
||||
title,
|
||||
body,
|
||||
draft,
|
||||
baseBranchName,
|
||||
upstreamName
|
||||
}: CreatePullRequestArgs): Promise<PullRequest>;
|
||||
fetchPrTemplate(path?: string): Promise<string | undefined>;
|
||||
merge(method: MergeMethod, prNumber: number): Promise<void>;
|
||||
prMonitor(prNumber: number): GitHostPrMonitor;
|
||||
|
@ -76,3 +76,11 @@ export type GitHostArguments = {
|
||||
baseBranch: string;
|
||||
forkStr?: string;
|
||||
};
|
||||
|
||||
export type CreatePullRequestArgs = {
|
||||
title: string;
|
||||
body: string;
|
||||
draft: boolean;
|
||||
baseBranchName: string;
|
||||
upstreamName: string;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user