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:
parent
5da39b4ff0
commit
3ada9fc562
|
@ -35,7 +35,7 @@ echo "Getting the list of milestones...\n";
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
repository(owner:\"$repo_owner\", name:\"$repo_name\") {
|
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 {
|
nodes {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
@ -48,7 +48,7 @@ $json = do_graphql_api_request( $query );
|
||||||
$milestones = $json['data']['repository']['milestones']['nodes'];
|
$milestones = $json['data']['repository']['milestones']['nodes'];
|
||||||
$milestones = array_map(
|
$milestones = array_map(
|
||||||
function( $x ) {
|
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
|
$milestones
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue