Public Access
Add ensureReleaseTags: create development/beta/release-candidate tags on sync
Ensures all repos have standard release channel tags pointing to the default branch. Tags are created if missing, skipped if they exist. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -379,6 +379,7 @@ class BulkSync extends CLIApp
|
||||
// (e.g. 54 new labels on a fresh repo), reset it so file sync proceeds.
|
||||
if (!$this->dryRun) {
|
||||
$this->ensureRepoLabels($org, $repoName);
|
||||
$this->ensureReleaseTags($org, $repoName);
|
||||
$this->api->resetCircuitBreaker();
|
||||
}
|
||||
|
||||
@@ -958,8 +959,51 @@ class BulkSync extends CLIApp
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tracking issue in the target repository after a successful sync.
|
||||
* Ensure standard release tags exist on the repository.
|
||||
*
|
||||
* Creates 'development', 'beta', and 'release-candidate' tags pointing
|
||||
* to the default branch HEAD if they don't already exist. These tags
|
||||
* are used by the release workflow to track stability channels.
|
||||
*/
|
||||
private function ensureReleaseTags(string $org, string $repo): void
|
||||
{
|
||||
$requiredTags = ['development', 'beta', 'release-candidate'];
|
||||
|
||||
try {
|
||||
$existingTags = $this->api->get("/repos/{$org}/{$repo}/tags", ['limit' => 50]);
|
||||
} catch (\Exception $e) {
|
||||
return; // Non-critical
|
||||
}
|
||||
|
||||
$existingNames = array_column($existingTags, 'name');
|
||||
|
||||
// Get default branch to point new tags at
|
||||
try {
|
||||
$repoInfo = $this->api->get("/repos/{$org}/{$repo}");
|
||||
$defaultBranch = $repoInfo['default_branch'] ?? 'main';
|
||||
} catch (\Exception $e) {
|
||||
$defaultBranch = 'main';
|
||||
}
|
||||
|
||||
foreach ($requiredTags as $tagName) {
|
||||
if (in_array($tagName, $existingNames, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->api->post("/repos/{$org}/{$repo}/tags", [
|
||||
'tag_name' => $tagName,
|
||||
'target' => $defaultBranch,
|
||||
'message' => "Release channel: {$tagName}",
|
||||
]);
|
||||
$this->log(" 🏷️ Created tag '{$tagName}' on {$repo}", 'INFO');
|
||||
} catch (\Exception $e) {
|
||||
// Non-critical — tag may already exist as a release tag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge main into all open PR branches (except the sync branch itself).
|
||||
*
|
||||
* This ensures feature/development branches stay up to date with the
|
||||
|
||||
Reference in New Issue
Block a user