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

Fix various problems (multiple commits) #64

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions funcs_scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,24 @@ function is_docs()
return $moduleName === 'developer-docs' || $moduleName === 'silverstripe-userhelp-content';
}

/**
* Determine if the module being processed is commercially supported
*
* Example usage:
* is_supported()
*/
function is_supported()
{
global $GITHUB_REF;
return in_array(
$GITHUB_REF,
array_column(
MetaData::getAllRepositoryMetaData()[MetaData::CATEGORY_SUPPORTED],
'github'
)
);
}

/**
* Determine if the module being processed is a gha-* repository e.g. gha-ci
* aka "WORKFLOW"
Expand All @@ -263,7 +281,7 @@ function is_gha_repository()
* Determine if the module being processed is "TOOLING"
*
* Example usage:
* is_gha_repository()
* is_tooling()
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
*/
function is_tooling()
{
Expand All @@ -281,7 +299,7 @@ function is_tooling()
* Determine if the module being processed is "MISC"
*
* Example usage:
* is_gha_repository()
* is_misc()
*/
function is_misc()
{
Expand Down
4 changes: 2 additions & 2 deletions scripts/cms-any/add-prs-to-project.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$content = <<<EOT
$content = <<<'EOT'
name: Add new pull requests to a github project

on:
Expand All @@ -25,7 +25,7 @@
EOT;

$actionPath = '.github/workflows/add-prs-to-project.yml';
$shouldHaveAction = module_account() === 'silverstripe' && is_module() && !module_is_recipe();
$shouldHaveAction = module_account() === 'silverstripe' && is_supported() && is_docs() || (is_module() && !module_is_recipe());

if ($shouldHaveAction) {
write_file_even_if_exists($actionPath, $content);
Expand Down
14 changes: 13 additions & 1 deletion update_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
global $MODULE_DIR, $GITHUB_REF, $OUT, $PRS_CREATED, $REPOS_WITH_PRS_CREATED;
$OUT = $output;

$reposMissingBranch = [];

// validate system is ready
validate_system();

Expand Down Expand Up @@ -146,8 +148,10 @@
$branchOption
);
}
// If we can't identify an appropriate branch, add to a list so we can report about it later.
if (!in_array($branchToCheckout, $allBranches)) {
error("Could not find branch to checkout for $repo using --branch=$branchOption");
$reposMissingBranch[] = $repo;
continue;
}
}
cmd("git checkout $branchToCheckout", $MODULE_DIR);
Expand Down Expand Up @@ -219,5 +223,13 @@
}
output_repos_with_prs_created();
output_prs_created();

// Report about any repos for which we couldn't find the right branch.
if (count($reposMissingBranch)) {
$reposString = implode("\n- ", $reposMissingBranch);
warning("Could not find branch to checkout for the following repos using --branch=$branchOption:\n- $reposString");
return Command::FAILURE;
}
Comment on lines +227 to +232
Copy link
Member Author

@GuySartorelli GuySartorelli Jun 18, 2024

Choose a reason for hiding this comment

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

Looks like this at the end of execution (after all other output):

image

Used to be a single error for each one, which automatically halted the run. You'd have to then add the repo to the exclude list, run it again, and repeat the next time it fails, etc.


return Command::SUCCESS;
};
Loading