Public Access
chore(rebrand): gitea -> git (MokoGitea -> MokoGit, .mokogitea -> .mokogit)
Case-preserving gitea->git across the mokocli monorepo: brand text, functional identifiers (MOKOGITEA_TOKEN, GITEA_URL/ORG/REPO, --gitea-url), and all nested .mokogitea/ dirs (top-level + mcp/servers/*) -> .mokogit/. Protected: literal `.gitea` (upstream workflow-detection paths in the Enterprise plugins) and git.mokoconsulting.tech. WARNING: CI-breaking until the MokoGit server side is reconfigured. Claude-Session: https://claude.ai/code/session_01DQEMmJPe61ya7HDfA6BHP8
This commit is contained in:
+18
-18
@@ -13,7 +13,7 @@
|
||||
* REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli
|
||||
* PATH: /cli/bulk_workflow_push.php
|
||||
* VERSION: 09.43.00
|
||||
* BRIEF: Push a workflow file to all governed repos via the Gitea Contents API
|
||||
* BRIEF: Push a workflow file to all governed repos via the Git Contents API
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
@@ -31,18 +31,18 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setDescription('Push a workflow file to all governed repos via the Gitea Contents API');
|
||||
$this->addArgument('--gitea-url', 'Gitea URL (default: https://git.mokoconsulting.tech)', 'https://git.mokoconsulting.tech');
|
||||
$this->addArgument('--token', 'Gitea API token', '');
|
||||
$this->setDescription('Push a workflow file to all governed repos via the Git Contents API');
|
||||
$this->addArgument('--git-url', 'Git URL (default: https://git.mokoconsulting.tech)', 'https://git.mokoconsulting.tech');
|
||||
$this->addArgument('--token', 'Git API token', '');
|
||||
$this->addArgument('--org', 'Target organization', '');
|
||||
$this->addArgument('--file', 'Local workflow file to push', '');
|
||||
$this->addArgument('--dest', 'Destination path in repos (default: .mokogitea/workflows/<filename>)', '');
|
||||
$this->addArgument('--dest', 'Destination path in repos (default: .mokogit/workflows/<filename>)', '');
|
||||
$this->addArgument('--branch', 'Target branch (default: main)', 'main');
|
||||
}
|
||||
|
||||
protected function run(): int
|
||||
{
|
||||
$giteaUrl = rtrim($this->getArgument('--gitea-url'), '/');
|
||||
$gitUrl = rtrim($this->getArgument('--git-url'), '/');
|
||||
$token = $this->getArgument('--token');
|
||||
$org = $this->getArgument('--org');
|
||||
$workflowFile = $this->getArgument('--file');
|
||||
@@ -70,7 +70,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
}
|
||||
|
||||
if ($destPath === '') {
|
||||
$destPath = '.mokogitea/workflows/' . basename($workflowFile);
|
||||
$destPath = '.mokogit/workflows/' . basename($workflowFile);
|
||||
}
|
||||
|
||||
$localContent = file_get_contents($workflowFile);
|
||||
@@ -82,7 +82,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
|
||||
$this->log('INFO', "Pushing: {$workflowFile}");
|
||||
$this->log('INFO', " -> {$destPath} (branch: {$branch})");
|
||||
$this->log('INFO', " -> Org: {$org} @ {$giteaUrl}");
|
||||
$this->log('INFO', " -> Org: {$org} @ {$gitUrl}");
|
||||
|
||||
if ($this->dryRun) {
|
||||
$this->log('INFO', '[DRY RUN] No changes will be made.');
|
||||
@@ -90,7 +90,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
|
||||
echo "\n";
|
||||
|
||||
$repos = $this->fetchOrgRepos($giteaUrl, $token, $org);
|
||||
$repos = $this->fetchOrgRepos($gitUrl, $token, $org);
|
||||
|
||||
if ($repos === null) {
|
||||
return 1;
|
||||
@@ -104,7 +104,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
$encodedContent = base64_encode($localContent);
|
||||
|
||||
foreach ($repos as $repo) {
|
||||
$this->pushToRepo($giteaUrl, $token, $repo, $encodedContent, $localContent, $destPath, $branch);
|
||||
$this->pushToRepo($gitUrl, $token, $repo, $encodedContent, $localContent, $destPath, $branch);
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
@@ -115,7 +115,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
}
|
||||
|
||||
private function pushToRepo(
|
||||
string $giteaUrl,
|
||||
string $gitUrl,
|
||||
string $token,
|
||||
string $repoFullName,
|
||||
string $encodedContent,
|
||||
@@ -126,7 +126,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
[$owner, $repoName] = explode('/', $repoFullName, 2);
|
||||
|
||||
$existing = $this->apiRequest(
|
||||
$giteaUrl,
|
||||
$gitUrl,
|
||||
$token,
|
||||
'GET',
|
||||
"/api/v1/repos/{$owner}/{$repoName}/contents/"
|
||||
@@ -159,7 +159,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
]);
|
||||
|
||||
$response = $this->apiRequest(
|
||||
$giteaUrl,
|
||||
$gitUrl,
|
||||
$token,
|
||||
'PUT',
|
||||
"/api/v1/repos/{$owner}/{$repoName}/contents/"
|
||||
@@ -189,7 +189,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
]);
|
||||
|
||||
$response = $this->apiRequest(
|
||||
$giteaUrl,
|
||||
$gitUrl,
|
||||
$token,
|
||||
'POST',
|
||||
"/api/v1/repos/{$owner}/{$repoName}/contents/"
|
||||
@@ -210,7 +210,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
}
|
||||
}
|
||||
|
||||
private function fetchOrgRepos(string $giteaUrl, string $token, string $org): ?array
|
||||
private function fetchOrgRepos(string $gitUrl, string $token, string $org): ?array
|
||||
{
|
||||
$this->log('INFO', "Fetching repos from org: {$org}");
|
||||
|
||||
@@ -219,7 +219,7 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
|
||||
while (true) {
|
||||
$response = $this->apiRequest(
|
||||
$giteaUrl,
|
||||
$gitUrl,
|
||||
$token,
|
||||
'GET',
|
||||
"/api/v1/orgs/{$org}/repos?"
|
||||
@@ -261,13 +261,13 @@ class BulkWorkflowPushCli extends CliFramework
|
||||
}
|
||||
|
||||
private function apiRequest(
|
||||
string $giteaUrl,
|
||||
string $gitUrl,
|
||||
string $token,
|
||||
string $method,
|
||||
string $endpoint,
|
||||
?string $body = null
|
||||
): array {
|
||||
$url = $giteaUrl . $endpoint;
|
||||
$url = $gitUrl . $endpoint;
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
||||
Reference in New Issue
Block a user