Tweaking output
This commit is contained in:
parent
d75deea884
commit
082ed23f12
47
chirp.php
47
chirp.php
|
@ -9,9 +9,27 @@ $auth_token = gitea_login($gitea_url, $user, $pass);
|
|||
if(!$auth_token)
|
||||
throw new Exception("Could not login to gitea");
|
||||
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletik', false);
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletor');
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletor-rnd');
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletik',
|
||||
array(
|
||||
'check_forks' => true,
|
||||
'check_composer' => true,
|
||||
'check_upm' => false
|
||||
)
|
||||
);
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletor',
|
||||
array(
|
||||
'check_forks' => true,
|
||||
'check_composer' => true,
|
||||
'check_upm' => true
|
||||
)
|
||||
);
|
||||
gitea_check_base_repo($auth_token, $gitea_url, 'bit/skeletor-rnd',
|
||||
array(
|
||||
'check_forks' => true,
|
||||
'check_composer' => true,
|
||||
'check_upm' => true
|
||||
)
|
||||
);
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
|
@ -129,12 +147,19 @@ function _is_composer_git_repo(array $repos, $repo)
|
|||
return false;
|
||||
}
|
||||
|
||||
function gitea_check_base_repo($auth_token, $gitea_url, $base_repo, $check_upm = true)
|
||||
function gitea_check_base_repo(
|
||||
$auth_token,
|
||||
$gitea_url,
|
||||
$base_repo,
|
||||
array $opts
|
||||
)
|
||||
{
|
||||
echo "=== Checking base repo '$base_repo' ===\n";
|
||||
echo "************************* Checking base repo '$base_repo' *************************\n";
|
||||
|
||||
$commits = gitea_get_commits($auth_token, $gitea_url, $base_repo);
|
||||
|
||||
if($opts['check_forks'])
|
||||
{
|
||||
$forks = gitea_get_forks($auth_token, $gitea_url, $base_repo);
|
||||
echo "== Checking forks ==\n";
|
||||
foreach($forks as $fork)
|
||||
|
@ -145,7 +170,7 @@ function gitea_check_base_repo($auth_token, $gitea_url, $base_repo, $check_upm =
|
|||
$status = gitea_get_commit($auth_token, $gitea_url, $repo_fork, $commit['sha']);
|
||||
if($status === null)
|
||||
{
|
||||
echo "Fork '$repo_fork' is behind '$base_repo' at ({$commit['sha']}, {$commit['commit']['author']['date']} by {$commit['commit']['author']['name']})\n";
|
||||
echo "Fork '$repo_fork' is behind\n";
|
||||
break;
|
||||
}
|
||||
//early exit if commit exists
|
||||
|
@ -155,7 +180,10 @@ function gitea_check_base_repo($auth_token, $gitea_url, $base_repo, $check_upm =
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($opts['check_composer'])
|
||||
{
|
||||
echo "== Checking Composer manifest ==\n";
|
||||
$composer_json = gitea_get_source($auth_token, $gitea_url, $base_repo, "composer/composer.json");
|
||||
$composer_arr = json_decode($composer_json, true);
|
||||
|
@ -173,13 +201,14 @@ function gitea_check_base_repo($auth_token, $gitea_url, $base_repo, $check_upm =
|
|||
{
|
||||
$last_tag_info = $tags[0];
|
||||
if(ltrim($last_tag_info["name"], 'v') != ltrim($version, 'v'))
|
||||
echo "Newer version in $repo: current $version, latest {$last_tag_info["name"]}\n";
|
||||
echo "Package update '$repo': current $version, latest {$last_tag_info["name"]}\n";
|
||||
}
|
||||
else
|
||||
echo "Could not fetch tags for $repo\n";
|
||||
}
|
||||
}
|
||||
|
||||
if($check_upm)
|
||||
if($opts['check_upm'])
|
||||
{
|
||||
echo "== Checking UPM manifest ==\n";
|
||||
$upm_json = gitea_get_source($auth_token, $gitea_url, $base_repo, "unity/Packages/manifest.json");
|
||||
|
@ -200,7 +229,7 @@ function gitea_check_base_repo($auth_token, $gitea_url, $base_repo, $check_upm =
|
|||
{
|
||||
$last_tag_info = $tags[0];
|
||||
if(ltrim($last_tag_info["name"], 'v') != ltrim($version, 'v'))
|
||||
echo "Newer version in $repo: current $version, latest {$last_tag_info["name"]}\n";
|
||||
echo "Package update '$repo': current $version, latest {$last_tag_info["name"]}\n";
|
||||
}
|
||||
else
|
||||
echo "Could not fetch tags for $repo\n";
|
||||
|
|
Loading…
Reference in New Issue