Normalize patch.createTempCommit
Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/core": "^0.7.4",
|
||||
"@backstage/core": "^0.7.5",
|
||||
"@backstage/integration": "^0.5.1",
|
||||
"@backstage/theme": "^0.2.5",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
|
||||
@@ -156,12 +156,17 @@ export interface IPluginApiClient {
|
||||
releaseBranchTree: string;
|
||||
selectedPatchCommit: GhGetCommitResponse;
|
||||
} & PartialProject,
|
||||
) => Promise<Todo>;
|
||||
) => Promise<{
|
||||
message: string;
|
||||
sha: string;
|
||||
}>;
|
||||
|
||||
forceBranchHeadToTempCommit: (
|
||||
args: {
|
||||
releaseBranchName: string;
|
||||
tempCommit: GhCreateCommitResponse;
|
||||
tempCommit: ApiMethodRetval<
|
||||
IPluginApiClient['patch']['createTempCommit']
|
||||
>;
|
||||
} & PartialProject,
|
||||
) => Promise<Todo>;
|
||||
|
||||
@@ -532,22 +537,18 @@ export class PluginApiClient implements IPluginApiClient {
|
||||
selectedPatchCommit: GhGetCommitResponse;
|
||||
} & PartialProject) => {
|
||||
const { octokit } = await this.getOctokit();
|
||||
const { data: tempCommit } = await octokit.git.createCommit({
|
||||
owner,
|
||||
repo,
|
||||
message: `Temporary commit for patch ${tagParts.patch}`,
|
||||
tree: releaseBranchTree,
|
||||
parents: [selectedPatchCommit.parents[0].sha],
|
||||
});
|
||||
|
||||
const tempCommit: GhCreateCommitResponse = (
|
||||
await octokit.request(
|
||||
`/repos/${this.getRepoPath({ owner, repo })}/git/commits`,
|
||||
{
|
||||
method: 'POST',
|
||||
data: {
|
||||
message: `Temporary commit for patch ${tagParts.patch}`,
|
||||
tree: releaseBranchTree,
|
||||
parents: [selectedPatchCommit.parents[0].sha],
|
||||
},
|
||||
},
|
||||
)
|
||||
).data;
|
||||
|
||||
return { tempCommit };
|
||||
return {
|
||||
message: tempCommit.message,
|
||||
sha: tempCommit.sha,
|
||||
};
|
||||
},
|
||||
|
||||
forceBranchHeadToTempCommit: async ({
|
||||
@@ -557,7 +558,9 @@ export class PluginApiClient implements IPluginApiClient {
|
||||
tempCommit,
|
||||
}: {
|
||||
releaseBranchName: string;
|
||||
tempCommit: GhCreateCommitResponse;
|
||||
tempCommit: ApiMethodRetval<
|
||||
IPluginApiClient['patch']['createTempCommit']
|
||||
>;
|
||||
} & PartialProject) => {
|
||||
const { octokit } = await this.getOctokit();
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ export async function patch({
|
||||
* > parentSha = commit.parents.head // first parent -- there should only be one
|
||||
* > tempCommit = POST /repos/$owner/$repo/git/commits { "message": "temp", "tree": branchTree, "parents": [parentSha] }
|
||||
*/
|
||||
const { tempCommit } = await pluginApiClient.patch.createTempCommit({
|
||||
const tempCommit = await pluginApiClient.patch.createTempCommit({
|
||||
...project,
|
||||
releaseBranchTree,
|
||||
selectedPatchCommit,
|
||||
|
||||
@@ -197,11 +197,9 @@ export const mockApiClient: IPluginApiClient = {
|
||||
} as GhCreateTagObjectResponse,
|
||||
}),
|
||||
createTempCommit: jest.fn().mockResolvedValue({
|
||||
tempCommit: {
|
||||
message: 'mock_commit_message',
|
||||
sha: 'mock_commit_sha',
|
||||
} as GhCreateCommitResponse,
|
||||
}),
|
||||
message: 'mock_commit_message',
|
||||
sha: 'mock_commit_sha',
|
||||
} as ApiMethodRetval<IPluginApiClient['patch']['createTempCommit']>),
|
||||
forceBranchHeadToTempCommit: jest.fn().mockResolvedValue(undefined),
|
||||
merge: jest.fn().mockResolvedValue({
|
||||
merge: {
|
||||
|
||||
@@ -1678,6 +1678,50 @@
|
||||
lodash "^4.17.19"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@backstage/core@^0.7.5":
|
||||
version "0.7.5"
|
||||
resolved "https://artifactory.spotify.net/artifactory/api/npm/virtual-npm/@backstage/core/-/core-0.7.5.tgz#27e0a7982dbab40973eefaa185d89babdd454913"
|
||||
integrity sha1-J+CnmC26tAlz7vqhhdibq91FSRM=
|
||||
dependencies:
|
||||
"@backstage/config" "^0.1.4"
|
||||
"@backstage/core-api" "^0.2.16"
|
||||
"@backstage/errors" "^0.1.1"
|
||||
"@backstage/theme" "^0.2.5"
|
||||
"@material-ui/core" "^4.11.0"
|
||||
"@material-ui/icons" "^4.9.1"
|
||||
"@material-ui/lab" "4.0.0-alpha.45"
|
||||
"@testing-library/react-hooks" "^3.4.2"
|
||||
"@types/dagre" "^0.7.44"
|
||||
"@types/prop-types" "^15.7.3"
|
||||
"@types/react" "^16.9"
|
||||
"@types/react-sparklines" "^1.7.0"
|
||||
"@types/react-text-truncate" "^0.14.0"
|
||||
classnames "^2.2.6"
|
||||
clsx "^1.1.0"
|
||||
d3-selection "^2.0.0"
|
||||
d3-shape "^2.0.0"
|
||||
d3-zoom "^2.0.0"
|
||||
dagre "^0.8.5"
|
||||
immer "^9.0.1"
|
||||
lodash "^4.17.15"
|
||||
material-table "^1.69.1"
|
||||
prop-types "^15.7.2"
|
||||
qs "^6.9.4"
|
||||
rc-progress "^3.0.0"
|
||||
react "^16.12.0"
|
||||
react-dom "^16.12.0"
|
||||
react-helmet "6.1.0"
|
||||
react-hook-form "^6.6.0"
|
||||
react-markdown "^5.0.2"
|
||||
react-router "6.0.0-beta.0"
|
||||
react-router-dom "6.0.0-beta.0"
|
||||
react-sparklines "^1.7.0"
|
||||
react-syntax-highlighter "^15.4.3"
|
||||
react-text-truncate "^0.16.0"
|
||||
react-use "^15.3.3"
|
||||
remark-gfm "^1.0.0"
|
||||
zen-observable "^0.8.15"
|
||||
|
||||
"@bcoe/v8-coverage@^0.2.3":
|
||||
version "0.2.3"
|
||||
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
|
||||
Reference in New Issue
Block a user