mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-05-18 19:49:13 -04:00
feat: disable comment if dry-run
This commit is contained in:
parent
1f09f3d7ea
commit
7c420531c8
4 changed files with 53 additions and 7 deletions
|
@ -93,7 +93,7 @@ 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) {
|
||||
if (!configs.dryRun && 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);
|
||||
|
@ -139,13 +139,12 @@ export default class Runner {
|
|||
|
||||
// 5. create new branch from target one and checkout
|
||||
this.logger.debug("Creating local branch..");
|
||||
|
||||
await git.gitCli.createLocalBranch(configs.folder, backportPR.head);
|
||||
|
||||
// 6. fetch pull request remote if source owner != target owner or pull request still open
|
||||
if (configs.originalPullRequest.sourceRepo.owner !== configs.originalPullRequest.targetRepo.owner ||
|
||||
configs.originalPullRequest.state === "open") {
|
||||
this.logger.debug("Fetching pull request remote..");
|
||||
this.logger.debug("Fetching pull request remote..");
|
||||
const prefix = git.gitClientType === GitClientType.GITLAB ? "merge-requests" : "pull" ; // default is for gitlab
|
||||
await git.gitCli.fetch(configs.folder, `${prefix}/${configs.originalPullRequest.number}/head:pr/${configs.originalPullRequest.number}`);
|
||||
}
|
||||
|
@ -171,4 +170,4 @@ export default class Runner {
|
|||
|
||||
this.logger.clearContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue