Skip to content

Commit

Permalink
Merge pull request #250 from Automattic/fix/no-issues-msg
Browse files Browse the repository at this point in the history
Record that feedback was submitted on auto-approval, rename function.
  • Loading branch information
gudmdharalds authored Feb 23, 2022
2 parents 8c25da4 + 8e4b67f commit 072e1ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
8 changes: 8 additions & 0 deletions auto-approval.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 #' .
Expand Down
8 changes: 4 additions & 4 deletions reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/ReportResultsToGithubWereSubmittedTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Test vipgoci_report_results_to_github_were_submitted() function.
* Test vipgoci_report_feedback_to_github_was_submitted() function.
*
* @package Automattic/vip-go-ci
*/
Expand All @@ -26,14 +26,14 @@ protected function setUp() :void {
}

/**
* Call vipgoci_report_results_to_github_were_submitted() in different ways,
* Call vipgoci_report_feedback_to_github_was_submitted() in different ways,
* test if it behaves as it should do.
*
* @covers ::vipgoci_report_results_to_github_were_submitted
* @covers ::vipgoci_report_feedback_to_github_was_submitted
*/
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,
Expand All @@ -42,15 +42,15 @@ 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
)
);

$this->assertFalse(
vipgoci_report_results_to_github_were_submitted(
vipgoci_report_feedback_to_github_was_submitted(
'test-owner',
'test-name',
2,
Expand All @@ -59,15 +59,15 @@ 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
)
);

$this->assertTrue(
vipgoci_report_results_to_github_were_submitted(
vipgoci_report_feedback_to_github_was_submitted(
'test-owner',
'test-name',
1,
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 072e1ba

Please sign in to comment.