Change GH API query for milestones to get only the open ones.

Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
This commit is contained in:
Néstor Soriano 2021-04-19 14:46:45 +02:00 committed by GitHub
parent 5da39b4ff0
commit 3ada9fc562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ echo "Getting the list of milestones...\n";
$query = "
repository(owner:\"$repo_owner\", name:\"$repo_name\") {
milestones(first: 10, orderBy: {field: CREATED_AT, direction: DESC}) {
milestones(first: 10, states: [OPEN], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes {
id
title
@ -48,7 +48,7 @@ $json = do_graphql_api_request( $query );
$milestones = $json['data']['repository']['milestones']['nodes'];
$milestones = array_map(
function( $x ) {
return 'OPEN' === $x['state'] && 1 === preg_match( '/^\d+\.\d+\.\d+$/D', $x['title'] ) ? $x : null;
return 1 === preg_match( '/^\d+\.\d+\.\d+$/D', $x['title'] ) ? $x : null;
},
$milestones
);