Skip to content

Commit

Permalink
Added Deleted field to support codecommit ref delete events (#531)
Browse files Browse the repository at this point in the history
* added support for Deleted field for codecommit ref delete events

* added test cases

* fixed indentation issue

* fixed indentation issue

* deleted .idea folder

---------

Co-authored-by: Bryan Moffatt <[email protected]>
  • Loading branch information
praveenk007 and bmoffatt authored Nov 30, 2023
1 parent 2ff7818 commit 0ad0619
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion events/code_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ type CodeCommitReference struct {
Commit string `json:"commit"`
Ref string `json:"ref"`
Created bool `json:"created,omitempty"`
Deleted bool `json:"deleted,omitempty"`
}

// String returns a string representation of this object.
// Useful for testing and debugging.
func (r CodeCommitReference) String() string {
return fmt.Sprintf(
"{commit: %v, ref: %v, created: %v}", r.Commit, r.Ref, r.Created)
"{commit: %v, ref: %v, created: %v, deleted: %v}", r.Commit, r.Ref, r.Created, r.Deleted)
}
15 changes: 15 additions & 0 deletions events/code_commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ func TestCodeCommitReference(t *testing.T) {
"ref": "refs/heads/master",
"created": true
}
`),
},
{
Name: "Deleted CodeCommitReference",
Input: []byte(`
{
"commit": "5c4ef1049f1d27deadbeeff313e0730018be182b",
"ref": "refs/heads/master",
"deleted": true
}
`),
},
}
Expand Down Expand Up @@ -62,6 +72,11 @@ func TestCodeCommitCodeCommit(t *testing.T) {
"commit": "5c4ef1049f1d27deadbeeff313e0730018be182b",
"ref": "refs/heads/master",
"created": true
},
{
"commit": "5c4ef1049f1d27deadbeeff313e0730018be182b",
"ref": "refs/heads/master",
"deleted": true
}
]
}
Expand Down

0 comments on commit 0ad0619

Please sign in to comment.