Skip to content

Commit

Permalink
fix(codecommit): notifyOnPullRequestMerged method has a typo in its n…
Browse files Browse the repository at this point in the history
…ame (#17348)

The current method `notifiyOnPullRequestMerged` has a typo in the name.
This PR is to create a method called `notifyOnPullRequestMerged` with the same functionality,
minus the spelling mistake. 

Marks `notifiyOnPullRequestMerged` as deprecated so as not to break existing code.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
clairemr authored Nov 9, 2021
1 parent 27ad7d8 commit cac5726
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions packages/@aws-cdk/aws-codecommit/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,23 @@ 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,
target: notifications.INotificationRuleTarget,
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.
*/
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit cac5726

Please sign in to comment.