Skip to content

Commit

Permalink
Merge pull request #23 from PrestaShop/check-zip
Browse files Browse the repository at this point in the history
Add check for release ZIP
  • Loading branch information
kpodemski authored Jun 24, 2023
2 parents e5df175 + b11458f commit e67d3ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function getClassByNbCommitsAhead(int $nbCommitsAhead): string
'multiple_milestones' => [],
'version_mismatch' => [],
'wrong_version' => [],
'missing_zip' => [],
];

$template = file_get_contents(__DIR__.'/src/template.tpl');
Expand All @@ -108,6 +109,10 @@ function getClassByNbCommitsAhead(int $nbCommitsAhead): string
$lastReleaseInformation[] = '<strong style="color:red;">Release not published yet!</strong>';
$notifications['not_published'][] = $moduleName;
}
if ($data['latestRelease']['built_zip'] === false) {
$lastReleaseInformation[] = '<strong style="color:red;">Release is missing built ZIP!</strong>';
$notifications['missing_zip'][] = $moduleName;
}
} else {
$lastReleaseInformation[] = 'No release yet';
}
Expand Down Expand Up @@ -252,6 +257,11 @@ function getClassByNbCommitsAhead(int $nbCommitsAhead): string
Versions of modules <strong>' . implode(', ', $notifications['wrong_version']) . '</strong> don\'t match the last or any current open milestone.
</div>';
}
if (!empty($notifications['missing_zip'])) {
$notifications_html .= '<div class="alert alert-warning" role="alert">
Modules <strong>' . implode(', ', $notifications['missing_zip']) . '</strong> don\'t have a proper built ZIP attached.
</div>';
}
if (!empty($notifications['not_published'])) {
$notifications_html .= '<div class="alert alert-warning" role="alert">
Modules <strong>' . implode(', ', $notifications['not_published']) . '</strong> have releases created, but not published.
Expand Down
10 changes: 10 additions & 0 deletions src/BranchManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,22 @@ public function getReleaseData($repositoryName)
$repositoryName,
);
if (!empty($release)) {
// Check if there is a proper zip attached
$built_zip = false;
foreach ($release['assets'] as $asset) {
if ($asset['name'] == $repositoryName . '.zip') {
$built_zip = true;
}
}

// Load info about the release
$latestRelease = [
'date' => (new DateTime($release['created_at']))->format('Y-m-d H:i:s'),
'name' => $release['name'],
'tag' => $release['tag_name'],
'url' => $release['html_url'],
'date_published' => (new DateTime($release['published_at']))->format('Y-m-d H:i:s'),
'built_zip' => $built_zip,
];
}
} catch (Exception $e) {
Expand Down

0 comments on commit e67d3ee

Please sign in to comment.