From 197990479c0278e6fba92c52533a0dacf1d9b70f Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Tue, 30 Aug 2022 15:19:13 +0300 Subject: [PATCH] Adding --dry-run mode which once enabled prevents sending reports to Slack --- chirp.inc.php | 3 ++- chirp.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/chirp.inc.php b/chirp.inc.php index 77c56b2..dedb8d0 100644 --- a/chirp.inc.php +++ b/chirp.inc.php @@ -221,8 +221,9 @@ function gitea_check_repo( ) { $r = new Reporters(); - $r->add(new SlackReporter()); $r->add(new CliReporter()); + if($opts['log_to_slack']) + $r->add(new SlackReporter()); $r->write("************************* Chirping about repo '$base_repo' *************************\n"); diff --git a/chirp.php b/chirp.php index 0773ae6..f7ecf42 100644 --- a/chirp.php +++ b/chirp.php @@ -5,6 +5,7 @@ $user = getenv('GITEA_USER'); $pass = getenv('GITEA_PASS'); $gitea_url = 'https://git.bit5.ru'; +$log_to_slack = !in_array('--dry-run', $argv); $auth_token = hoopoe\gitea_login($gitea_url, $user, $pass); if(!$auth_token) @@ -14,28 +15,32 @@ hoopoe\gitea_check_repo($auth_token, $gitea_url, 'bit/skeletik', array( 'check_forks' => true, 'check_composer' => true, - 'check_upm' => false + 'check_upm' => false, + 'log_to_slack' => $log_to_slack, ) ); hoopoe\gitea_check_repo($auth_token, $gitea_url, 'bit/skeletor', array( 'check_forks' => true, 'check_composer' => true, - 'check_upm' => true + 'check_upm' => true, + 'log_to_slack' => $log_to_slack, ) ); hoopoe\gitea_check_repo($auth_token, $gitea_url, 'bit/skeletor-rnd', array( 'check_forks' => true, 'check_composer' => true, - 'check_upm' => true + 'check_upm' => true, + 'log_to_slack' => $log_to_slack, ) ); hoopoe\gitea_check_repo($auth_token, $gitea_url, 'game/gymmania', array( 'check_forks' => false, 'check_composer' => true, - 'check_upm' => false + 'check_upm' => false, + 'log_to_slack' => $log_to_slack, ) );