Skip to content

Commit

Permalink
fix: improve github issue template (#4181)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvikan authored Jul 31, 2024
1 parent b505667 commit 8ae716e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions actions/DisplayAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,33 @@ private function logBridgeError($bridgeName, $code)
return $report['count'];
}

private static function createGithubIssueUrl($bridge, $e, string $message): string
private static function createGithubIssueUrl(BridgeAbstract $bridge, \Exception $e, string $message): string
{
return sprintf('https://github.com/RSS-Bridge/rss-bridge/issues/new?%s', http_build_query([
'title' => sprintf('%s failed with error %s', $bridge->getName(), $e->getCode()),
$maintainer = $bridge->getMaintainer();
if (str_contains($maintainer, ',')) {
$maintainers = explode(',', $maintainer);
} else {
$maintainers = [$maintainer];
}
$maintainers = array_map('trim', $maintainers);

$query = [
'title' => $bridge->getName() . ' failed with: ' . $e->getMessage(),
'body' => sprintf(
"```\n%s\n\n%s\n\nQuery string: %s\nVersion: %s\nOs: %s\nPHP version: %s\n```",
"```\n%s\n\n%s\n\nQuery string: %s\nVersion: %s\nOs: %s\nPHP version: %s\n```\nMaintainer: @%s",
$message,
implode("\n", trace_to_call_points(trace_from_exception($e))),
$_SERVER['QUERY_STRING'] ?? '',
Configuration::getVersion(),
PHP_OS_FAMILY,
phpversion() ?: 'Unknown'
phpversion() ?: 'Unknown',
implode(', @', $maintainers),
),
'labels' => 'Bridge-Broken',
'assignee' => $bridge->getMaintainer(),
]));
'assignee' => $maintainer[0],
];

return 'https://github.com/RSS-Bridge/rss-bridge/issues/new?' . http_build_query($query);
}

private static function createGithubSearchUrl($bridge): string
Expand Down

0 comments on commit 8ae716e

Please sign in to comment.