diff --git a/packages/@aws-cdk/aws-codecommit/lib/repository.ts b/packages/@aws-cdk/aws-codecommit/lib/repository.ts index e55053c0249be..f9cd4c318cb19 100644 --- a/packages/@aws-cdk/aws-codecommit/lib/repository.ts +++ b/packages/@aws-cdk/aws-codecommit/lib/repository.ts @@ -177,6 +177,7 @@ export interface IRepository extends IResource, notifications.INotificationRuleS /** * Defines a CodeStar Notification rule which triggers when a pull request is merged. + * @deprecated this method has a typo in its name, use notifyOnPullRequestMerged instead */ notifiyOnPullRequestMerged( id: string, @@ -184,6 +185,15 @@ export interface IRepository extends IResource, notifications.INotificationRuleS options?: notifications.NotificationRuleOptions, ): notifications.INotificationRule; + /** + * Defines a CodeStar Notification rule which triggers when a pull request is merged. + */ + notifyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + /** * Defines a CodeStar Notification rule which triggers when a new branch or tag is created. */ @@ -419,6 +429,14 @@ abstract class RepositoryBase extends Resource implements IRepository { id: string, target: notifications.INotificationRuleTarget, options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOnPullRequestMerged(id, target, options); + } + + public notifyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, ): notifications.INotificationRule { return this.notifyOn(id, target, { ...options, diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts b/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts index 4f7a5926a47ac..9e61f82141178 100644 --- a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts +++ b/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts @@ -14,6 +14,6 @@ const repository = new codecommit.Repository(stack, 'MyCodecommitRepository', { const target = new sns.Topic(stack, 'MyTopic'); repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); -repository.notifiyOnPullRequestMerged('NotifyOnPullRequestMerged', target); +repository.notifyOnPullRequestMerged('NotifyOnPullRequestMerged', target); app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts b/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts index 32540aefc1111..721ce01d4c490 100644 --- a/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts +++ b/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts @@ -14,7 +14,7 @@ describe('notification rule', () => { repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); - repository.notifiyOnPullRequestMerged('NotifyOnPullRequestMerged', target); + repository.notifyOnPullRequestMerged('NotifyOnPullRequestMerged', target); expect(stack).toHaveResource('AWS::CodeStarNotifications::NotificationRule', { Name: 'MyCodecommitRepositoryNotifyOnPullRequestCreatedBB14EA32',