diff --git a/auto-approval.php b/auto-approval.php index e866f56e4..999ba2cc3 100644 --- a/auto-approval.php +++ b/auto-approval.php @@ -354,6 +354,14 @@ function( $type ) { ) . ').' ); + + // Record that we submitted feedback to GitHub. + vipgoci_report_feedback_to_github_was_submitted( + $options['repo-owner'], + $options['repo-name'], + $pr_item->number, + true + ); } else { vipgoci_log( 'Will not actually approve Pull-Request #' . diff --git a/reports.php b/reports.php index 7fc9fec13..534cc3156 100644 --- a/reports.php +++ b/reports.php @@ -457,7 +457,7 @@ function vipgoci_report_create_scan_details( * * @return bool True if feedback has been submitted at any time, else false. */ -function vipgoci_report_results_to_github_were_submitted( +function vipgoci_report_feedback_to_github_was_submitted( string $repo_owner, string $repo_name, int $pr_number, @@ -516,7 +516,7 @@ function vipgoci_report_maybe_no_issues_found( ); foreach ( $prs_implicated as $pr_item ) { - if ( true === vipgoci_report_results_to_github_were_submitted( + if ( true === vipgoci_report_feedback_to_github_was_submitted( $repo_owner, $repo_name, $pr_item->number @@ -780,7 +780,7 @@ function vipgoci_report_submit_pr_generic_comment_from_results( $github_token ); - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( $repo_owner, $repo_name, $pr_number, @@ -1238,7 +1238,7 @@ function vipgoci_report_submit_pr_review_from_results( $github_token ); - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( $repo_owner, $repo_name, $pr_number, diff --git a/tests/unit/ReportResultsToGithubWereSubmittedTest.php b/tests/unit/ReportResultsToGithubWereSubmittedTest.php index 15ceab0d4..afd3bc84c 100644 --- a/tests/unit/ReportResultsToGithubWereSubmittedTest.php +++ b/tests/unit/ReportResultsToGithubWereSubmittedTest.php @@ -1,6 +1,6 @@ assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1, @@ -42,7 +42,7 @@ public function testReportResultsToGitHubSubmitted(): void { ); $this->assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1 @@ -50,7 +50,7 @@ public function testReportResultsToGitHubSubmitted(): void { ); $this->assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 2, @@ -59,7 +59,7 @@ public function testReportResultsToGitHubSubmitted(): void { ); $this->assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 2 @@ -67,7 +67,7 @@ public function testReportResultsToGitHubSubmitted(): void { ); $this->assertTrue( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1, @@ -76,7 +76,7 @@ public function testReportResultsToGitHubSubmitted(): void { ); $this->assertTrue( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1 @@ -85,7 +85,7 @@ public function testReportResultsToGitHubSubmitted(): void { // Set PR number 1 again to false; should have no effect. $this->assertTrue( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1, @@ -95,7 +95,7 @@ public function testReportResultsToGitHubSubmitted(): void { // Test PR number 1 again. $this->assertTrue( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 1 @@ -104,7 +104,7 @@ public function testReportResultsToGitHubSubmitted(): void { // Set to false before; should be false. $this->assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 2 @@ -113,7 +113,7 @@ public function testReportResultsToGitHubSubmitted(): void { // Never set before; should be false. $this->assertFalse( - vipgoci_report_results_to_github_were_submitted( + vipgoci_report_feedback_to_github_was_submitted( 'test-owner', 'test-name', 3