@@ -166,24 +166,19 @@ function processEvent(event, callback) {
166
166
var githubEventType = requestBody [ "X-GitHub-Event" ] ;
167
167
// Handle installation events
168
168
if ( githubEventType === "installation_repositories" ) {
169
- // Currently ignoring repository removal events, only calling the endpoint if we are adding a repository.
170
- if ( body . action === "added" ) {
171
- console . log ( "Valid installation event" ) ;
172
- path += "workflows/github/install" ;
173
- const repositoriesAdded = body . repositories_added ;
174
- const repositories = repositoriesAdded . map ( ( repo ) => repo . full_name ) ;
175
-
176
- postEndpoint ( path , body , deliveryId , ( response ) => {
177
- const successMessage =
178
- "The GitHub app was successfully installed on repositories " +
179
- repositories ;
180
- handleCallback ( response , successMessage , callback ) ;
181
- } ) ;
182
- } else {
183
- console . log (
184
- 'installation_repositories event ignored "' + body . action + '" action'
185
- ) ;
186
- }
169
+ // The installation_repositories event contains information about both additions and removals.
170
+ console . log ( "Valid installation event" ) ;
171
+ path += "workflows/github/install" ;
172
+ postEndpoint ( path , body , deliveryId , ( response ) => {
173
+ const added = body . action === "added" ;
174
+ const repositories = (
175
+ added ? body . repositories_added : body . repositories_removed
176
+ ) . map ( ( repo ) => repo . full_name ) ;
177
+ const successMessage = `The GitHub app was successfully ${
178
+ added ? "installed" : "uninstalled"
179
+ } on repositories ${ repositories } `;
180
+ handleCallback ( response , successMessage , callback ) ;
181
+ } ) ;
187
182
} else if ( githubEventType === "push" ) {
188
183
/**
189
184
* We only handle push events, of which there are many subtypes. Unfortunately, the only way to differentiate between them is to look
0 commit comments