|
33 | 33 | class EvaluateCommand extends Command |
34 | 34 | { |
35 | 35 |
|
| 36 | + private const EXIT_ERROR = 1; |
| 37 | + private const EXIT_AFFECTS_ISSUES = 2; |
| 38 | + private const EXIT_NO_AFFECTED_ISSUES = 0; |
| 39 | + |
36 | 40 | public function __construct( |
37 | 41 | private TabCreator $tabCreator, |
38 | 42 | private PostGenerator $postGenerator, |
@@ -133,7 +137,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
133 | 137 | } |
134 | 138 | } |
135 | 139 |
|
| 140 | + $exitCode = self::EXIT_AFFECTS_ISSUES; |
136 | 141 | if (count($toPost) === 0) { |
| 142 | + $exitCode = self::EXIT_NO_AFFECTED_ISSUES; |
137 | 143 | $output->writeln(sprintf('No changes in results in %d code snippets from %d GitHub issues. :tada:', $totalCodeSnippets, count($issueCache->getIssues()))); |
138 | 144 | } |
139 | 145 |
|
@@ -163,7 +169,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
163 | 169 | if ($postComments) { |
164 | 170 | if (count($toPost) > 20) { |
165 | 171 | $output->writeln('Too many comments to post, something is probably wrong.'); |
166 | | - return 1; |
| 172 | + return self::EXIT_ERROR; |
167 | 173 | } |
168 | 174 | foreach ($toPost as ['issue' => $issue, 'hash' => $hash, 'users' => $users, 'diff' => $diff, 'details' => $details]) { |
169 | 175 | $text = sprintf( |
@@ -191,7 +197,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
191 | 197 | } |
192 | 198 | } |
193 | 199 |
|
194 | | - return 0; |
| 200 | + return $exitCode; |
195 | 201 | } |
196 | 202 |
|
197 | 203 | /** |
|
0 commit comments