mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge pull request #11639 from appwrite/improve-sdk-pr-summary
feat: improve SDK PR summary with platform grouping and clipboard copy
This commit is contained in:
1 file changed
+27
-11
@@ -89,7 +89,7 @@ class SDKs extends Action
|
||||
$selectedSDK = $sdk;
|
||||
|
||||
if (! $sdks) {
|
||||
$selectedPlatform ??= Console::confirm('Choose Platform ("' . implode('", "', static::getPlatforms()) . '" or "*" for all):');
|
||||
$selectedPlatform ??= Console::confirm('Choose Platform ("' . implode('", "', static::getPlatforms()) . '", comma-separated, or "*" for all):');
|
||||
$selectedSDK ??= \strtolower(Console::confirm('Choose SDK ("*" for all):'));
|
||||
$supportedSDKs = $this->getSupportedSDKs();
|
||||
if ($selectedSDK !== '*' && ! \in_array($selectedSDK, $supportedSDKs)) {
|
||||
@@ -140,9 +140,20 @@ class SDKs extends Action
|
||||
throw new \Exception('Unknown version given');
|
||||
}
|
||||
|
||||
$selectedPlatforms = ($selectedPlatform === '*' || $selectedPlatform === null) ? null : \array_map('trim', \explode(',', $selectedPlatform));
|
||||
|
||||
if ($selectedPlatforms !== null) {
|
||||
$validPlatforms = static::getPlatforms();
|
||||
foreach ($selectedPlatforms as $p) {
|
||||
if (! \in_array($p, $validPlatforms)) {
|
||||
throw new \Exception('Unknown platform "' . $p . '". Options are: ' . implode(', ', $validPlatforms));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$platforms = Config::getParam('sdks');
|
||||
foreach ($platforms as $key => $platform) {
|
||||
if ($selectedPlatform !== $key && $selectedPlatform !== '*' && ($sdks === null)) {
|
||||
if ($selectedPlatforms !== null && ! \in_array($key, $selectedPlatforms) && ($sdks === null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -532,7 +543,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
$pushSuccess = $this->pushToGit($language, $target, $result, $gitUrl, $gitBranch, $repoBranch, $commitMessage);
|
||||
|
||||
if ($pushSuccess) {
|
||||
$this->createPullRequest($language, $target, $gitBranch, $repoBranch, $aiChangelog, $prUrls);
|
||||
$this->createPullRequest($language, $platform['name'], $target, $gitBranch, $repoBranch, $aiChangelog, $prUrls);
|
||||
}
|
||||
|
||||
\exec('chmod -R u+w ' . $target . ' && rm -rf ' . $target);
|
||||
@@ -546,8 +557,12 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
if (! empty($prUrls)) {
|
||||
Console::log('');
|
||||
Console::info('━━━ Pull Request Summary ━━━');
|
||||
foreach ($prUrls as $sdkName => $url) {
|
||||
Console::log(" {$sdkName}: {$url}");
|
||||
foreach ($prUrls as $platformName => $sdks) {
|
||||
Console::log('');
|
||||
Console::info(" {$platformName}:");
|
||||
foreach ($sdks as $sdkName => $url) {
|
||||
Console::log(" {$sdkName}: {$url}");
|
||||
}
|
||||
}
|
||||
Console::log('');
|
||||
}
|
||||
@@ -657,7 +672,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
return true;
|
||||
}
|
||||
|
||||
private function createPullRequest(array $language, string $target, string $gitBranch, string $repoBranch, string $aiChangelog, array &$prUrls): void
|
||||
private function createPullRequest(array $language, string $platformName, string $target, string $gitBranch, string $repoBranch, string $aiChangelog, array &$prUrls): void
|
||||
{
|
||||
$prTitle = "feat: {$language['name']} SDK update for version {$language['version']}";
|
||||
$prBody = "This PR contains updates to the {$language['name']} SDK for version {$language['version']}.";
|
||||
@@ -685,7 +700,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
Console::success(" Pull request created");
|
||||
foreach ($prOutput as $line) {
|
||||
if (\str_starts_with(trim($line), 'https://')) {
|
||||
$prUrls[$language['name']] = trim($line);
|
||||
$prUrls[$platformName][$language['name']] = trim($line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -703,7 +718,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateExistingPr($repoName, $gitBranch, $prTitle, $prBody, $language['name'], $prUrls, $existingPrUrl);
|
||||
$this->updateExistingPr($repoName, $gitBranch, $prTitle, $prBody, $platformName, $language['name'], $prUrls, $existingPrUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -730,7 +745,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
'mkdir -p ' . $resultExamples . $languagePath . ' && \
|
||||
cp -r ' . $examplesSource . ' ' . $resultExamples
|
||||
);
|
||||
Console::success(" Examples copied to {$resultExamples}");
|
||||
$label = \is_string($languageTitle) ? " ({$languageTitle})" : '';
|
||||
Console::success(" Examples{$label} copied to {$resultExamples}{$languagePath}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1081,7 +1097,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
}
|
||||
}
|
||||
|
||||
private function updateExistingPr(string $repoName, string $gitBranch, string $prTitle, string $prBody, string $sdkName, array &$prUrls, string $existingPrUrl = ''): void
|
||||
private function updateExistingPr(string $repoName, string $gitBranch, string $prTitle, string $prBody, string $platformName, string $sdkName, array &$prUrls, string $existingPrUrl = ''): void
|
||||
{
|
||||
Console::log(' Pull request already exists, updating...');
|
||||
|
||||
@@ -1140,7 +1156,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
Console::success(" Pull request updated");
|
||||
|
||||
if (! empty($prUrl)) {
|
||||
$prUrls[$sdkName] = $prUrl;
|
||||
$prUrls[$platformName][$sdkName] = $prUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user