Skip to content

Commit

Permalink
FIX Init array and use $oldName
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 28, 2024
1 parent f2a67c6 commit 6a3bffb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions labels_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@
'type/api-change' => 'type/api-break',
];

// Repos that should not have labels updated
const REPOS_EXCLUDE = [
// note that akismet is different from silverstripe-akismet
// installers is composer/installers
'akismet',
'classproxy',
'installers',
'GridFiedBulkEditingTools',
'phockito',
'silverstripe-fluent',
'silverstripe-phockito',
'silverstripe-proxy-db',
];

$labelsCommand = function(InputInterface $input, OutputInterface $output): int {
// This is the code that is executed when running the 'labels' command

Expand All @@ -61,7 +75,7 @@
foreach ([$modulesCurrentMajor, $modulesPreviousMajor] as $modulesList) {
foreach ($modulesList as $module) {
$repo = $module['repo'];
if (in_array($repo, $repos)) {
if (in_array($repo, $repos) || in_array($repo, REPOS_EXCLUDE)) {
continue;
}
$modules[] = $module;
Expand Down Expand Up @@ -99,9 +113,10 @@
} else {
github_api($url, ['new_name' => $newName], 'PATCH');
}
$oldName = $name;
$name = $newName;
// Update $url replacing the $name at the end with $newName
$url = substr($url, 0, strlen($url) - strlen($name)) . $newName;
$url = substr($url, 0, strlen($url) - strlen($oldName)) . $newName;
$labels[$key]['name'] = $newName;
$labels[$key]['url'] = $url;
}
Expand Down
1 change: 1 addition & 0 deletions run.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
$MODULE_DIR = '';
$PRS_CREATED = [];
$REPOS_WITH_PRS_CREATED = [];
$REPOS_WITH_LABELS_UPDATED = [];
$OUT = null;

// options
Expand Down

0 comments on commit 6a3bffb

Please sign in to comment.