Skip to content

Commit

Permalink
Remove Projects v1, double spaces & templates
Browse files Browse the repository at this point in the history
  • Loading branch information
DEVTomatoCake committed Nov 3, 2023
1 parent dbac969 commit 1d26d5e
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 274 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Exceptions:
- `registry_package` event has no templates in favor of the `package` event as recommended by GitHub
- `repository_vulnerability_alert` because it is deprecated in favor of `dependabot_alert` as recommended by GitHub
- `team_add` because the `added_to_repository` action from `team` is the same
- `repository_dispatch` because it is not used for webhooks
- `repository_dispatch` has no template because it is not used for webhooks
- `requested_action` and `rerequested` actions of the `check_run` event because they are not used for webhooks
- `requested` and `rerequested` actions of the `check_suite` event because they are not used for webhooks
- `project_card`, `project` and `project_column` have no templates due to being deprecated (Projects "Classic")
- `secret_scanning_alert_location` as it only triggers on issues `secret_scanning_alert` already triggers on
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ const hookFunc = async (req, res) => {
})
// Removing empty variables
message = message.replace(/{{ ?[^}]+ ?}}/gi, "")
// Remove double spaces
message = message.replace(/ +/gi, " ")

let parsed = {}
try {
Expand Down
3 changes: 2 additions & 1 deletion templates/check_run.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] **{{ check_run.name }}** check run completed {{ check_run.conclusion }}",
title: "[{{ repository.name }}] **{{ check_run.name }}** check run {{ check_run.conclusion }}",
url: "{{ check_run.html_url }}",
description: "{{ check_run.output.title }}\n\n{{ check_run.output.summary }}\n\n{{ check_run.output.text }}",
color: color("magenta")
}]
},{
Expand Down
15 changes: 9 additions & 6 deletions templates/custom_property.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `custom_property` (`created`)",
url: "{{ repository.html_url }}",
title: "[{{ organization.name }}] **{{ definition.property_name }}** {{ definition.value_type }} custom property created",
url: "https://github.com/organizations/{{ organization.login }}/settings/custom-properties",
description: "{{ definition.description }}",
color: color("green")
}]
},{
Expand All @@ -21,8 +22,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `custom_property` (`deleted`)",
url: "{{ repository.html_url }}",
title: "[{{ organization.name }}] Custom property **{{ definition.property_name }}** deleted",
url: "https://github.com/organizations/{{ organization.login }}/settings/custom-properties",
description: "{{ definition.description }}",
color: color("red")
}]
},{
Expand All @@ -33,8 +35,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `custom_property` (`updated`)",
url: "{{ repository.html_url }}",
title: "[{{ repository.name }}] Custom property **{{ definition.property_name }}** updated",
url: "https://github.com/organizations/{{ organization.login }}/settings/custom-properties",
description: "{{ definition.description }}",
color: color("cyan")
}]
}
Expand Down
4 changes: 2 additions & 2 deletions templates/custom_property_values.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = [
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] Custom property values updated",
url: "{{ repository.html_url }}",
description: "Now **{{ count(new_property_values) }}** custom property values, old value was **{{ count(old_property_values) }}**",
url: "{{ repository.html_url }}/settings/custom-properties",
description: "Now **{{ count(new_property_values) }}** custom property values, old amount was **{{ count(old_property_values) }}**",
color: color("cyan")
}]
}
Expand Down
6 changes: 3 additions & 3 deletions templates/deploy_key.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = [
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] Deploy key **{{ key.title }}** created",
url: "{{ repository.html_url }}",
url: "{{ repository.html_url }}/settings/keys",
color: color("green")
}]
},{
Expand All @@ -21,8 +21,8 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] Deploy key **{{ key.title }}** deleted",
url: "{{ repository.html_url }}",
title: "[{{ repository.name }}] {{ key.verified ? Verified : }} Deploy key **{{ key.title }}** deleted",
url: "{{ repository.html_url }}/settings/keys",
color: color("red")
}]
}
Expand Down
2 changes: 1 addition & 1 deletion templates/discussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] Discussion **#{{ discussion.number }}** unanswered",
title: "[{{ repository.name }}] Answer removed from discussion **#{{ discussion.number }}**",
url: "{{ discussion.html_url }}",
color: color("red")
}]
Expand Down
1 change: 0 additions & 1 deletion templates/discussion_comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = [
author: {
name: "{{ sender.login }}",
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] Comment on discussion **#{{ discussion.number }}** edited",
Expand Down
1 change: 0 additions & 1 deletion templates/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module.exports = [
author: {
name: "{{ sender.login }}",
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ forkee.full_name }}] Fork created",
Expand Down
8 changes: 4 additions & 4 deletions templates/installation_repositories.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module.exports = [
name: "{{ requester.login }}",
icon_url: "{{ requester.avatar_url }}"
},
title: "**{{ count(repositories_added) }}]** repositories added to installation",
url: "{{ repository.html_url }}",
title: "**{{ count(repositories_added) }}** repositories added to **{{ installation.account.login }}**",
url: "{{ organization.html_url }}",
color: color("green")
}]
},{
Expand All @@ -19,8 +19,8 @@ module.exports = [
name: "{{ requester.login }}",
icon_url: "{{ requester.avatar_url }}"
},
title: "**{{ count(repositories_removed) }}]** repositories removed from installation",
url: "{{ repository.html_url }}",
title: "**{{ count(repositories_removed) }}** repositories removed from **{{ installation.account.login }}**",
url: "{{ organization.html_url }}",
color: color("red")
}]
}
Expand Down
26 changes: 14 additions & 12 deletions templates/milestone.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `milestone` (`closed`)",
url: "{{ repository.html_url }}",
color: color("black")
title: "[{{ repository.name }}] Milestone **{{ milestone.title }}** closed",
url: "{{ milestone.html_url }}",
color: color("gray")
}]
},{
action: "created",
Expand All @@ -21,8 +21,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `milestone` (`created`)",
url: "{{ repository.html_url }}",
title: "[{{ repository.name }}] Milestone **{{ milestone.title }}** created",
url: "{{ milestone.html_url }}",
description: "{{ milestone.description }}",
color: color("green")
}]
},{
Expand All @@ -33,8 +34,8 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `milestone` (`deleted`)",
url: "{{ repository.html_url }}",
title: "[{{ repository.name }}] Milestone **{{ milestone.title }}** deleted",
url: "{{ milestone.html_url }}",
color: color("red")
}]
},{
Expand All @@ -45,8 +46,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `milestone` (`edited`)",
url: "{{ repository.html_url }}",
title: "[{{ repository.name }}] Milestone **{{ milestone.title }}** edited",
url: "{{ milestone.html_url }}",
description: "Open issues: **{{ milestone.open_issues }}**\nClosed issues: **{{ milestone.closed_issues }}**\n\n{{ milestone.description }}",
color: color("cyan")
}]
},{
Expand All @@ -57,9 +59,9 @@ module.exports = [
icon_url: "{{ sender.avatar_url }}",
url: "{{ sender.html_url }}"
},
title: "[{{ repository.name }}] `milestone` (`opened`)",
url: "{{ repository.html_url }}",
color: color("black")
title: "[{{ repository.name }}] Milestone **{{ milestone.title }}** opened",
url: "{{ milestone.html_url }}",
color: color("gray")
}]
}
]
65 changes: 0 additions & 65 deletions templates/project.js

This file was deleted.

65 changes: 0 additions & 65 deletions templates/project_card.js

This file was deleted.

53 changes: 0 additions & 53 deletions templates/project_column.js

This file was deleted.

Loading

0 comments on commit 1d26d5e

Please sign in to comment.