Browse Source

Fixes issue with filter prs by state

main
Eric Amodio 4 years ago
parent
commit
2a0c00aab3
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/github/github.ts

+ 4
- 3
src/github/github.ts View File

@ -26,11 +26,11 @@ export class GitHubApi {
const cc = Logger.getCorrelationContext();
try {
const query = `query pr($owner: String!, $repo: String!, $branch: String!, $limit: Int!, $states: [PullRequestState!], $avatarSize: Int) {
const query = `query pr($owner: String!, $repo: String!, $branch: String!, $limit: Int!, $include: [PullRequestState!], $avatarSize: Int) {
repository(name: $repo, owner: $owner) {
refs(query: $branch, refPrefix: "refs/heads/", first: 1) {
nodes {
associatedPullRequests(first: $limit, orderBy: {field: UPDATED_AT, direction: DESC}, states: $states) {
associatedPullRequests(first: $limit, orderBy: {field: UPDATED_AT, direction: DESC}, states: $include) {
nodes {
author {
login
@ -56,6 +56,8 @@ export class GitHubApi {
}
}`;
options = { limit: 1, ...options };
const rsp = await graphql<{
repository:
| {
@ -75,7 +77,6 @@ export class GitHubApi {
branch: branch,
headers: { authorization: `Bearer ${token}` },
...options,
limit: options?.limit ?? 1,
});
const pr = rsp?.repository?.refs.nodes[0]?.associatedPullRequests?.nodes?.[0];

Loading…
Cancel
Save