Skip to content

Commit 7599e38

Browse files
committed
updates to webhooks and adding some scripts
1 parent 1ef042c commit 7599e38

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

scripts/analyze_fields.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public function analyze(): void
101101
echo "Waiting for {$numChunks} child processes to complete...\n";
102102
$completed = 0;
103103
foreach ($pids as $i => $pid) {
104-
pcntl_waitpid($pid, $status[$i]);
104+
$status = 0;
105+
pcntl_waitpid($pid, $status);
105106
$completed++;
106107
if ($completed % 2 === 0 || $completed === $numChunks) {
107108
echo " Completed {$completed}/{$numChunks} child processes...\n";
@@ -299,10 +300,6 @@ private function extractFields(array $data, string $prefix = ''): array
299300
}
300301

301302
foreach ($data as $key => $value) {
302-
if (!is_string($key) && !is_int($key)) {
303-
continue;
304-
}
305-
306303
$path = empty($prefix) ? (string)$key : $prefix . '.' . (string)$key;
307304

308305
if (is_array($value)) {
@@ -822,7 +819,7 @@ private function buildGroupFieldsDetail(array $fieldCounts, array $groupCounts,
822819
}
823820

824821
/**
825-
* @param array<string, array<string, array<string, int>>> $fieldCounts
822+
* @param array<string, array<string, array<string, mixed>>> $fieldCounts
826823
*/
827824
private function getAllGroupKeys(array $fieldCounts): array
828825
{

scripts/filter_webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function buildWhitelistForEvent(string $event, array $baseWhitelist, array $even
167167
/**
168168
* Recursively filter array by whitelist
169169
*/
170-
function filterRecursive(array $data, array $whitelist, string $prefix = 'data'): array
170+
function filterRecursive(array $data, array $whitelist, string $prefix): array
171171
{
172172
$result = [];
173173

scripts/filter_webhook_batch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ function buildWhitelistForEvent(string $event, array $baseWhitelist, array $even
239239
/**
240240
* Recursively filter array by whitelist
241241
*/
242-
function filterRecursive(array $data, array $whitelist, string $prefix = 'data'): array
242+
function filterRecursive(array $data, array $whitelist, string $prefix): array
243243
{
244244
$result = [];
245245

web/github.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ function buildDedupKey(string $eventType, string $repo, array $payload): string
236236
case 'status':
237237
$sha = $getSha($payload, 'sha');
238238
return $sha !== '' ? "github:commit:{$repo}:{$sha}" : "github:status:{$repo}";
239+
case 'deployment':
240+
case 'deployment_status':
241+
$sha = $getSha($payload['deployment'] ?? [], 'sha');
242+
return $sha !== '' ? "github:commit:{$repo}:{$sha}" : "github:{$eventType}:{$repo}";
239243
case 'star':
240244
case 'watch':
241245
case 'fork':

0 commit comments

Comments
 (0)