mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-14 09:39:13 -04:00
feat: implement error notification as pr comment (#124)
* feat: implement error notification as pr comment * Update action.yml Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com> * feat: implement gitlab client and surround with try catch * docs: add error notification enablment in the doc * feat: disable comment if dry-run * feat: update the default comment on error --------- Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
This commit is contained in:
parent
6042bcc40b
commit
2bb7f73112
28 changed files with 594 additions and 39 deletions
|
@ -144,6 +144,10 @@ describe("gitlab merge request config parser", () => {
|
|||
labels: [],
|
||||
comments: [],
|
||||
});
|
||||
expect(configs.errorNotification).toEqual({
|
||||
"enabled": false,
|
||||
"message": "The backport to `{{target-branch}}` failed. Check the latest run for more details."
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
@ -882,4 +886,26 @@ describe("gitlab merge request config parser", () => {
|
|||
comments: ["First comment", "Second comment"],
|
||||
});
|
||||
});
|
||||
|
||||
test("enable error notification message", async () => {
|
||||
const args: Args = {
|
||||
dryRun: false,
|
||||
auth: "",
|
||||
pullRequest: mergedPRUrl,
|
||||
targetBranch: "prod",
|
||||
enableErrorNotification: true,
|
||||
};
|
||||
|
||||
const configs: Configs = await configParser.parseAndValidate(args);
|
||||
|
||||
expect(GitLabClient.prototype.getPullRequest).toBeCalledTimes(1);
|
||||
expect(GitLabClient.prototype.getPullRequest).toBeCalledWith("superuser", "backporting-example", 1, undefined);
|
||||
expect(GitLabMapper.prototype.mapPullRequest).toBeCalledTimes(1);
|
||||
expect(GitLabMapper.prototype.mapPullRequest).toBeCalledWith(expect.anything(), []);
|
||||
|
||||
expect(configs.errorNotification).toEqual({
|
||||
"enabled": true,
|
||||
"message": "The backport to `{{target-branch}}` failed. Check the latest run for more details.",
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue