mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-13 00:59:12 -04:00
feat(gh75): extract target branched from pr labels (#112)
This commit is contained in:
parent
b2e2e271b9
commit
53cc505f17
20 changed files with 523 additions and 83 deletions
|
@ -471,7 +471,7 @@ describe("cli runner", () => {
|
|||
"-pr",
|
||||
"https://github.com/owner/reponame/pull/2368",
|
||||
"--labels",
|
||||
"cherry-pick :cherries:, original-label",
|
||||
"cherry-pick :cherries:, backport prod",
|
||||
"--inherit-labels",
|
||||
]);
|
||||
|
||||
|
@ -507,7 +507,7 @@ describe("cli runner", () => {
|
|||
body: "**Backport:** https://github.com/owner/reponame/pull/2368\r\n\r\nPlease review and merge",
|
||||
reviewers: ["gh-user", "that-s-a-user"],
|
||||
assignees: [],
|
||||
labels: ["cherry-pick :cherries:", "original-label"],
|
||||
labels: ["cherry-pick :cherries:", "backport prod"],
|
||||
comments: [],
|
||||
}
|
||||
);
|
||||
|
@ -601,7 +601,7 @@ describe("cli runner", () => {
|
|||
body: "New Body Prefix - New Body",
|
||||
reviewers: [],
|
||||
assignees: ["user3", "user4"],
|
||||
labels: ["cli github cherry pick :cherries:", "original-label"],
|
||||
labels: ["cli github cherry pick :cherries:", "backport prod"],
|
||||
comments: [],
|
||||
}
|
||||
);
|
||||
|
@ -1163,4 +1163,23 @@ describe("cli runner", () => {
|
|||
|
||||
// Not interested in all subsequent calls, already tested in other test cases
|
||||
});
|
||||
|
||||
test("extract target branch from label", async () => {
|
||||
addProcessArgs([
|
||||
"--target-branch-pattern",
|
||||
"^backport (?<target>([^ ]+))$",
|
||||
"-pr",
|
||||
"https://github.com/owner/reponame/pull/2368"
|
||||
]);
|
||||
|
||||
await runner.execute();
|
||||
|
||||
const cwd = process.cwd() + "/bp";
|
||||
|
||||
expect(GitClientFactory.getOrCreate).toBeCalledTimes(1);
|
||||
expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.GITHUB, undefined, "https://api.github.com");
|
||||
|
||||
expect(GitCLIService.prototype.clone).toBeCalledTimes(1);
|
||||
expect(GitCLIService.prototype.clone).toBeCalledWith("https://github.com/owner/reponame.git", cwd, "prod");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue