Api refactor, return object for createCommit

Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
Erik Engervall
2021-04-30 14:15:33 +02:00
parent ae0fede8fb
commit 4d4a630fa9
3 changed files with 14 additions and 8 deletions
@@ -366,8 +366,10 @@ export class GitReleaseApiClient implements GitReleaseApi {
});
return {
message: commit.message,
sha: commit.sha,
commit: {
message: commit.message,
sha: commit.sha,
},
};
};
@@ -666,8 +668,10 @@ export interface GitReleaseApi {
parents: string[];
} & OwnerRepo,
) => Promise<{
message: string;
sha: string;
commit: {
message: string;
sha: string;
};
}>;
updateRef: (
@@ -97,7 +97,7 @@ export function usePatch({
abortIfError(releaseBranchRes.error);
if (!releaseBranchRes.value) return undefined;
const tempCommit = await pluginApiClient
const { commit: tempCommit } = await pluginApiClient
.createCommit({
owner: project.owner,
repo: project.repo,
@@ -186,7 +186,7 @@ export function usePatch({
const releaseBranchSha = releaseBranchRes.value.releaseBranch.commit.sha;
const selectedPatchCommit = releaseBranchRes.value.selectedPatchCommit;
const cherryPickCommit = await pluginApiClient.createCommit({
const { commit: cherryPickCommit } = await pluginApiClient.createCommit({
owner: project.owner,
repo: project.repo,
message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}
@@ -260,8 +260,10 @@ export const mockApiClient: GitReleaseApi = {
})),
createCommit: jest.fn(async () => ({
message: 'mock_commit_message',
sha: 'mock_commit_sha',
commit: {
message: 'mock_commit_message',
sha: 'mock_commit_sha',
},
})),
updateRef: jest.fn(async () => ({