Skip to content

Commit

Permalink
Adjusts webhook processor. (#725)
Browse files Browse the repository at this point in the history
* hmm

* hmm

* Update github_webhook_processor.php

* Update github_webhook_processor.php
  • Loading branch information
Helg2 authored Nov 30, 2024
1 parent 6a7491d commit 0669a3b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
4 changes: 0 additions & 4 deletions tgui/packages/tgui/interfaces/Changelog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ const icons = {
expansion: { icon: 'check-circle', color: 'green' },
experiment: { icon: 'radiation', color: 'yellow' },
image: { icon: 'image', color: 'green' },
imageadd: { icon: 'tg-image-plus', color: 'green' },
imagedel: { icon: 'tg-image-minus', color: 'red' },
qol: { icon: 'hand-holding-heart', color: 'green' },
refactor: { icon: 'tools', color: 'green' },
rscadd: { icon: 'check-circle', color: 'green' },
rscdel: { icon: 'times-circle', color: 'red' },
server: { icon: 'server', color: 'purple' },
sound: { icon: 'volume-high', color: 'green' },
soundadd: { icon: 'tg-sound-plus', color: 'green' },
sounddel: { icon: 'tg-sound-minus', color: 'red' },
map: { icon: 'map', color: 'green' },
spellcheck: { icon: 'spell-check', color: 'green' },
tgs: { icon: 'toolbox', color: 'purple' },
Expand Down
41 changes: 17 additions & 24 deletions tools/WebhookProcessor/github_webhook_processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
// Only these repositories will announce in game.
// Any repository that players actually care about.
$game_announce_whitelist = array(
"tgstation",
"TerraGov-Marine-Corps",
"PMC-Unga-Marines",
"Unga-Marines",
);

// Any repository that matches in this blacklist will not appear on Discord.
Expand Down Expand Up @@ -187,7 +187,6 @@ function validate_user($payload) {
$res = github_apisend('https://api.github.com/search/issues?q='.$querystring);
$res = json_decode($res, TRUE);
return $res['total_count'] >= (int)$validation_count;

}

function get_labels($payload){
Expand Down Expand Up @@ -248,6 +247,8 @@ function tag_pr($payload, $opened) {
$tags[] = 'Revert';
if(strpos(strtolower($title), 'removes') !== FALSE)
$tags[] = 'Removal';
if(strpos(strtolower($title), 'ports') !== FALSE)
$tags[] = 'Port';
}

$remove = array('Test Merge Candidate');
Expand All @@ -258,7 +259,7 @@ function tag_pr($payload, $opened) {
else if ($mergeable === FALSE)
$tags[] = 'Merge Conflict';

$treetags = array('_maps' => 'Map Edit', 'tools' => 'Tools', 'SQL' => 'SQL', '.github' => 'GitHub');
$treetags = array('_maps' => 'Mapping', 'tools' => 'Tools', 'SQL' => 'SQL', '.github' => 'GitHub');
$addonlytags = array('icons' => 'Sprites', 'sound' => 'Sound', 'config' => 'Config Update', 'code/controllers/configuration/entries' => 'Config Update', 'tgui' => 'UI');
foreach($treetags as $tree => $tag)
if(has_tree_been_edited($payload, $tree))
Expand All @@ -270,7 +271,6 @@ function tag_pr($payload, $opened) {
$tags[] = $tag;

check_tag_and_replace($payload, '[dnm]', 'Do Not Merge', $tags);
check_tag_and_replace($payload, '[no gbp]', 'GBP: No Update', $tags);

return array($tags, $remove);
}
Expand Down Expand Up @@ -709,21 +709,14 @@ function checkchangelog($payload, $compile = true) {
break;
case 'qol':
if($item != 'made something easier to use') {
$tags[] = 'Quality of Life';
$tags[] = 'QoL';
$currentchangelogblock[] = array('type' => 'qol', 'body' => $item);
}
break;
case 'soundadd':
case 'sound':
if($item != 'added a new sound thingy') {
$tags[] = 'Sound';
$currentchangelogblock[] = array('type' => 'soundadd', 'body' => $item);
}
break;
case 'sounddel':
if($item != 'removed an old sound thingy') {
$tags[] = 'Sound';
$tags[] = 'Removal';
$currentchangelogblock[] = array('type' => 'sounddel', 'body' => $item);
$currentchangelogblock[] = array('type' => 'sound', 'body' => $item);
}
break;
case 'add':
Expand All @@ -742,17 +735,10 @@ function checkchangelog($payload, $compile = true) {
$currentchangelogblock[] = array('type' => 'rscdel', 'body' => $item);
}
break;
case 'imageadd':
case 'image':
if($item != 'added some icons and images') {
$tags[] = 'Sprites';
$currentchangelogblock[] = array('type' => 'imageadd', 'body' => $item);
}
break;
case 'imagedel':
if($item != 'deleted some icons and images') {
$tags[] = 'Sprites';
$tags[] = 'Removal';
$currentchangelogblock[] = array('type' => 'imagedel', 'body' => $item);
$currentchangelogblock[] = array('type' => 'image', 'body' => $item);
}
break;
case 'typo':
Expand All @@ -768,6 +754,13 @@ function checkchangelog($payload, $compile = true) {
$currentchangelogblock[] = array('type' => 'balance', 'body' => $item);
}
break;
case 'mapping':
case 'map':
if($item != 'added/modified/removed map content'){
$tags[] = 'Mapping';
$currentchangelogblock[] = array('type' => 'balance', 'body' => $item);
}
break;
case 'code_imp':
case 'code':
if($item != 'changed some code'){
Expand Down
4 changes: 2 additions & 2 deletions tools/WebhookProcessor/secret.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
$apiKey = '209ab8d879c0f987d06a09b9d879c0f987d06a09b9d8787d0a089c';

//The repository auto-updates are sourced from.
$repoOwnerAndName = "tgstation/tgstation";
$repoOwnerAndName = "PMC-Unga-Marines/Unga-Marines";

//Whitelist of repository names that have PRs auto-tagged
$repoAutoTaggerWhitelist = array("tgstation", "TerraGov-Marine-Corps");
$repoAutoTaggerWhitelist = array("PMC-Unga-Marines", "Unga-Marines");

//Auto update settings
$enable_live_tracking = true; //auto update this file from the repository
Expand Down

0 comments on commit 0669a3b

Please sign in to comment.