Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use shared mergeup logic #23

Merged
merged 3 commits into from
May 6, 2024
Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented May 2, 2024

Note that the empty columns do still need to be in the logic, because there is some overlap in support levels where those columns will be used.
For now I've opted to keep the columns in the markup so we can get this merged and have accurate information displaying - we can open a separate card to hide the columns when they're empty if it bothers people enough to spend dev time on,

Issues

@@ -111,7 +111,6 @@ class Consts
'silverstripe-security-extensions',
// 'silverstripe-upgrader',
'silverstripe-versionfeed', // not in commercially supported list, though is in cwp
'sspak',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sspak was messing things up. It'd be removed when we do #3 in the future anyway.

$off = $offset ? "{$op}{$offset}" : '';
$off = $offset ? "&{$offset}" : '';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was resulting in queries like https://api.github.com/repos/silverstripe/gha-dispatch-ci/tags?per_page=100?page=1 (note the double ?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be able to fetch files so we can get composer.json info

Comment on lines +82 to +91
// get branches
$json = $requester->fetch("/repos/$account/$repo?paginate=0", '', $account, $repo, $refetch);
$defaultBranch = $json->root->default_branch;
$repoData = MetaData::getMetaDataForRepository("$account/$repo");
$composerJson = $requester->fetchFile($account, $repo, $defaultBranch, 'composer.json', $refetch);
$branchesJson = $requester->fetch("/repos/$account/$repo/branches", '', $account, $repo, $refetch)->root ?? [];
$allRepoBranches = array_map(fn($x) => $x->name, $branchesJson);
$tagsJson = $requester->fetch("/repos/$account/$repo/tags", '', $account, $repo, $refetch)->root ?? [];
$allRepoTags = array_map(fn($x) => $x->name, $tagsJson);
$branches = BranchLogic::getBranchesForMergeUp("$account/$repo", $repoData, $defaultBranch, $allRepoTags, $allRepoBranches, $composerJson);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes how we get the branches - we're now using the shared logic which is based on what branches and tags exist, as well as mapping branches to CMS major releases. See related PRs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything below this is about how those branches are displayed, which needed to be updated to correctly display these branches in the correct columns, matching to the correct CMS releases and whether it's a patch branch, etc.

Comment on lines +133 to +139
$columns = [
$colPrefix . ' NextMin Branch',
$colPrefix . ' ToNextMin status',
$colPrefix . ' NextPat Branch',
$colPrefix . ' FromPrvMin status',
$colPrefix . ' PrvMin Branch',
];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the columns to be more immediately representative of what is in that column, with less mental load to translate them.

Before:
image

After:
image

composer.json Outdated
Comment on lines 21 to 26
"repositories": {
"silverstripe/supported-modules": {
"type": "vcs",
"url": "[email protected]:creative-commoners/supported-modules.git"
}
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for now for testing - but once silverstripe/supported-modules#28 is merged and added to packagist I'll remove the fork and run composer update so we have an up-to-date composer.lock.

@GuySartorelli GuySartorelli changed the title Pulls/main/use shared mergeup logic use shared mergeup logic May 2, 2024
@GuySartorelli GuySartorelli force-pushed the pulls/main/use-shared-mergeup-logic branch from 8cf1514 to 45c3dc1 Compare May 2, 2024 23:58
@GuySartorelli GuySartorelli force-pushed the pulls/main/use-shared-mergeup-logic branch from 45c3dc1 to 448b137 Compare May 6, 2024 02:18
composer.json Outdated
"repositories": {
"silverstripe/supported-modules": {
"type": "vcs",
"url": "[email protected]:creative-commoners/supported-modules.git"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to remove this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, now that the repo is in packagist.

@GuySartorelli GuySartorelli force-pushed the pulls/main/use-shared-mergeup-logic branch from 448b137 to 442804b Compare May 6, 2024 21:46
@emteknetnz emteknetnz merged commit b41956b into main May 6, 2024
@emteknetnz emteknetnz deleted the pulls/main/use-shared-mergeup-logic branch May 6, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants