Skip to content

Commit

Permalink
Merge pull request #121 from VipinDevelops/webhook-endpoints
Browse files Browse the repository at this point in the history
[FIX]: Updated Payload Handling
  • Loading branch information
samad-yar-khan authored Oct 18, 2023
2 parents 5cad47b + 8648900 commit 34f2648
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions github/endpoints/githubEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ export class githubWebHooks extends ApiEndpoint {
messageText = `*New Commits to* *[${payload.repository.full_name}](${payload.repository.html_url}) by ${payload.pusher.name}*`;
} else if (event == "pull_request") {
if(payload.action == "opened"){
messageText = `*[New Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.user.login}](${payload.user.html_url})* *|* *[${payload.repository.full_name}]*`;
messageText = `*[New Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.pull_request.user.login}](${payload.pull_request.user.html_url})* *|* *[${payload.repository.full_name}]*`;
}else if(payload.action == "closed" && payload.pull_request.merged ){
messageText = `*[Merged Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.user.login}](${payload.user.html_url})* *|* *[${payload.repository.full_name}]*`;
messageText = `*[Merged Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.pull_request.user.login}](${payload.pull_request.user.html_url})* *|* *[${payload.repository.full_name}]*`;
}else if(payload.action == "closed" && !payload.pull_request.merged){
messageText = `*[Closed Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.user.login}](${payload.user.html_url})* *|* *[${payload.repository.full_name}]*`;
messageText = `*[Closed Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.pull_request.user.login}](${payload.pull_request.user.html_url})* *|* *[${payload.repository.full_name}]*`;
}else if(payload.action =="reopened"){
messageText = `*[ReOpened Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.user.login}](${payload.user.html_url})* *|* *[${payload.repository.full_name}]*`;
messageText = `*[ReOpened Pull Request](${payload.pull_request.html_url})* *|* *#${payload.pull_request.number} ${payload.pull_request.title}* by *[${payload.pull_request.user.login}](${payload.pull_request.user.html_url})* *|* *[${payload.repository.full_name}]*`;
}else{
return this.success();
}
Expand Down Expand Up @@ -105,4 +105,4 @@ export class githubWebHooks extends ApiEndpoint {

return this.success();
}
}
}

0 comments on commit 34f2648

Please sign in to comment.