Skip to content

Commit

Permalink
fix: 🐛 Fixed Webhook Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
VipinDevelops committed Aug 21, 2023
1 parent 5ffdd66 commit c362233
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions github/endpoints/githubEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ export class githubWebHooks extends ApiEndpoint {
}
const eventCaps = event.toUpperCase();
let messageText = "newEvent !";

console.log(payload)
if (event == "push") {
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 @@ -106,3 +106,6 @@ export class githubWebHooks extends ApiEndpoint {
return this.success();
}
}



0 comments on commit c362233

Please sign in to comment.