From e9d3d7ba6701d479d5ff05d3d220900f96097c77 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Mon, 17 Jan 2022 00:26:13 +0500 Subject: [PATCH] [contrib] Place script for fetching contributors from GitHub's gist to contrib directory No need to depend on gist.github.com --- README.md | 2 +- .../prepare_release/fetch_contributors.php | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 contrib/prepare_release/fetch_contributors.php diff --git a/README.md b/README.md index 1f5edc46..808af1a7 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ We are RSS-Bridge community, a group of developers continuing the project initia **Contributors** (sorted alphabetically): * [16mhz](https://github.com/16mhz) diff --git a/contrib/prepare_release/fetch_contributors.php b/contrib/prepare_release/fetch_contributors.php new file mode 100644 index 00000000..cdcda7e3 --- /dev/null +++ b/contrib/prepare_release/fetch_contributors.php @@ -0,0 +1,94 @@ +])/', '', $url)); + $next = true; + break; + } + } + +} + +/* Example JSON data: https://api.github.com/repos/rss-bridge/rss-bridge/contributors */ + +// We want contributors sorted by name +usort($contributors, function($a, $b){ + return strcasecmp($a->login, $b->login); +}); + +// Export as Markdown list +foreach($contributors as $contributor) { + echo " * [{$contributor->login}]({$contributor->html_url})\n"; +} + +/** + * Parses the provided response header into an associative array + * + * Based on https://stackoverflow.com/a/18682872 + */ +function parseResponseHeader($header) { + + $headers = array(); + $requests = explode("\r\n\r\n", trim($header)); + + foreach ($requests as $request) { + + $header = array(); + + foreach (explode("\r\n", $request) as $i => $line) { + + if($i === 0) { + $header['http_code'] = $line; + } else { + + list ($key, $value) = explode(': ', $line); + $header[$key] = $value; + + } + + } + + $headers[] = $header; + + } + + return $headers; + +}