mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-15 10:09:12 -04:00
feat(issue-17): override backporting pr data (#29)
This commit is contained in:
parent
1732481b37
commit
941beda208
15 changed files with 279 additions and 30 deletions
|
@ -138,4 +138,46 @@ describe("gha runner", () => {
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
test("override backporting pr data", async () => {
|
||||
spyGetInput({
|
||||
"target-branch": "target",
|
||||
"pull-request": "https://github.com/owner/reponame/pull/2368",
|
||||
"title": "New Title",
|
||||
"body": "New Body",
|
||||
"body-prefix": "New Body Prefix - ",
|
||||
"bp-branch-name": "bp_branch_name",
|
||||
});
|
||||
|
||||
await runner.execute();
|
||||
|
||||
const cwd = process.cwd() + "/bp";
|
||||
|
||||
expect(GitCLIService.prototype.clone).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.clone).toBeCalledWith("https://github.com/owner/reponame.git", cwd, "target");
|
||||
|
||||
expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp_branch_name");
|
||||
|
||||
expect(GitCLIService.prototype.fetch).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368");
|
||||
|
||||
expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc");
|
||||
|
||||
expect(GitCLIService.prototype.push).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp_branch_name");
|
||||
|
||||
expect(GitHubService.prototype.createPullRequest).toBeCalledTimes(1);
|
||||
expect(GitHubService.prototype.createPullRequest).toBeCalledWith({
|
||||
owner: "owner",
|
||||
repo: "reponame",
|
||||
head: "bp_branch_name",
|
||||
base: "target",
|
||||
title: "New Title",
|
||||
body: "New Body Prefix - New Body",
|
||||
reviewers: ["gh-user", "that-s-a-user"]
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue