Skip to content
Open
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-cli
FROM php:8.1-cli

RUN apt-get update && \
apt-get -y --no-install-recommends install libxml2-utils && \
Expand Down
12 changes: 6 additions & 6 deletions csv-translation-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
$mageFilename = __DIR__.'/github/workspace/app/Mage.php';

require_once $mageFilename;
$app = Mage::app();
// $app = Mage::app();

$modifiedFiles = glob('app/locale/*/*.csv');
$allCsvFiles = glob('app/locale/*/*.csv');

foreach ($modifiedFiles as $file){
foreach ($allCsvFiles as $file) {
$csvParser = (new Varien_File_Csv())->getData("{$file}");

$i = 0;
foreach ($csvParser as $columns){
foreach ($csvParser as $columns) {
$i++;
if(count($columns) == 2){
if (count($columns) == 2) {
continue;
}

echo $file." validation failed: There are ".count($columns)." columns in line $i, it should be 2\n";
}
}

if($i > 0){
if ($i > 0) {
exit(101);
}
13 changes: 5 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/bash


ERROR=0

PHP_RESULT=$(php /csv-translation-validator.php ${MODIFIED_FILES})

echo "$PHP_RESULT"

IS_FAILED=$(echo $PHP_RESULT | grep "failed" | wc -l)




if [[ $IS_FAILED == 1 ]]
if [[ $(echo "$PHP_RESULT" | grep -c "failed") -gt 0 ]]
then
exit 101
elif [[ $(echo "$PHP_RESULT" | grep -c "error") -gt 0 ]]
then
exit 101
exit 102
fi

exit 0