Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63496df

Browse files
committed
minor #40928 [CI] Sort packages by length to match modified package better (Nyholm)
This PR was merged into the 5.3-dev branch. Discussion ---------- [CI] Sort packages by length to match modified package better | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Given the build error in #40927, I saw that we match "modified packages" wrong. The script things we modified `symfony/translation` rather than the new bridge. This is because we are using a simple [string matchning](https://github.com/symfony/symfony/blob/18658a29a37d6de3e73c95f96fb9e51bf1d5f59d/.github/get-modified-packages.php#L24). If we sort the packages by length, we make sure we match the most detailed (longest) string first. Commits ------- f7a0bd1 [CI] Sort packages by length to match modified package better
2 parents c78358f + f7a0bd1 commit 63496df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/get-modified-packages.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
$allPackages = json_decode($_SERVER['argv'][1], true, 512, \JSON_THROW_ON_ERROR);
1313
$modifiedFiles = json_decode($_SERVER['argv'][2], true, 512, \JSON_THROW_ON_ERROR);
1414

15+
// Sort to get the longest name first (match bridge not component)
16+
usort($allPackages, function($a, $b) {
17+
return strlen($b) <=> strlen($a) ?: $a <=> $b;
18+
});
19+
1520
function isComponentBridge(string $packageDir): bool
1621
{
1722
return 0 < preg_match('@Symfony/Component/.*/Bridge/@', $packageDir);

0 commit comments

Comments
 (0)