mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-18 11:39:12 -04:00
feat: implement error notification as pr comment
This commit is contained in:
parent
6042bcc40b
commit
c02522a9f1
27 changed files with 432 additions and 35 deletions
|
@ -9,6 +9,7 @@ import { BackportPullRequest, GitClientType, GitPullRequest } from "@bp/service/
|
|||
import LoggerService from "@bp/service/logger/logger-service";
|
||||
import LoggerServiceFactory from "@bp/service/logger/logger-service-factory";
|
||||
import { inferGitClient, inferGitApiUrl, getGitTokenFromEnv } from "@bp/service/git/git-util";
|
||||
import { injectError } from "./runner-util";
|
||||
|
||||
interface Git {
|
||||
gitClientType: GitClientType;
|
||||
|
@ -92,6 +93,11 @@ export default class Runner {
|
|||
});
|
||||
} catch(error) {
|
||||
this.logger.error(`Something went wrong backporting to ${pr.base}: ${error}`);
|
||||
if (configs.errorNotification.enabled && configs.errorNotification.message.length > 0) {
|
||||
// notify the failure as comment in the original pull request
|
||||
const comment = injectError(configs.errorNotification.message, error as string);
|
||||
gitApi.createPullRequestComment(configs.originalPullRequest.url, comment);
|
||||
}
|
||||
failures.push(error as string);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue