Skip to content

Commit

Permalink
No looping through every open Pull-Request, looking for the current c…
Browse files Browse the repository at this point in the history
…ommit

This support was needed when vip-go-ci needed to run for each commit pushed,
in order to not miss any commit and thus any potential change. vip-go-ci
does not work like that any longer and thus this is not needed.
  • Loading branch information
gudmdharalds committed Apr 23, 2018
1 parent fec1009 commit 98dab1f
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions github-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,6 @@ function vipgoci_github_prs_implicated(
*/

$prs_implicated = array();
$prs_maybe_implicated = array();


$page = 1;
Expand Down Expand Up @@ -1541,14 +1540,6 @@ function vipgoci_github_prs_implicated(
if ( $commit_id === $pr_item->head->sha ) {
$prs_implicated[ $pr_item->number ] = $pr_item;
}

else {
/*
* No match, might be relevant, so needs
* to be checked in more detail.
*/
$prs_maybe_implicated[] = $pr_item->number;
}
}

sleep ( 2 );
Expand All @@ -1557,44 +1548,6 @@ function vipgoci_github_prs_implicated(
} while ( count( $prs_implicated_unfiltered ) >= $per_page );


/*
* Look through any Pull-Requests that might be implicated
* -- to do this, we have fetch all commits implicated by all
* open Pull-Requests.
*/

foreach ( $prs_maybe_implicated as $pr_number_tmp ) {
if ( in_array(
$commit_id,
vipgoci_github_prs_commits_list(
$repo_owner,
$repo_name,
$pr_number_tmp,
$github_token
),
true
) ) {

$github_url =
'https://api.github.com/' .
'repos/' .
rawurlencode( $repo_owner ) . '/' .
rawurlencode( $repo_name ) . '/' .
'pulls/' .
rawurlencode( $pr_number_tmp );


$prs_implicated[ $pr_number_tmp ] =
json_decode(
vipgoci_github_fetch_url(
$github_url,
$github_token
)
);
}
}


/*
* Convert number parameter of each object
* saved to an integer.
Expand Down

0 comments on commit 98dab1f

Please sign in to comment.