Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Feb 20, 2024
1 parent 973abef commit 8fcd9a4
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions .github/actions/people/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@
# """

prs_query = """
query Q($after: String, $filter: String!) {
search(query: $filter, type: ISSUE, last: 100, after: $after) {
edges {
cursor
node {
... on PullRequest {
query Q($after: String) {
repository(name: "langchain", owner: "langchain-ai") {
pullRequests(first: 100, after: $after, states: MERGED) {
edges {
cursor
node {
changedFiles
additions
deletions
Expand Down Expand Up @@ -263,16 +263,20 @@ class PullRequestEdge(BaseModel):
node: PullRequestNode


class PullRequestSearchResponse(BaseModel):
class PullRequests(BaseModel):
edges: List[PullRequestEdge]


class PullRequestSearchResponseData(BaseModel):
search: PullRequestSearchResponse
class PRsRepository(BaseModel):
pullRequests: PullRequests


class PullRequestResponse(BaseModel):
data: PullRequestSearchResponseData
class PRsResponseData(BaseModel):
repository: PRsRepository


class PRsResponse(BaseModel):
data: PRsResponseData


class Settings(BaseSettings):
Expand All @@ -285,14 +289,13 @@ def get_graphql_response(
*,
settings: Settings,
query: str,
filter: Union[str, None] = None,
after: Union[str, None] = None,
category_id: Union[str, None] = None,
) -> Dict[str, Any]:
headers = {"Authorization": f"token {settings.input_token.get_secret_value()}"}
# category_id is only used by one query, but GraphQL allows unused variables, so
# keep it here for simplicity
variables = {"after": after, "category_id": category_id, "filter": filter}
variables = {"after": after, "category_id": category_id}
response = httpx.post(
github_graphql_url,
headers=headers,
Expand Down Expand Up @@ -343,11 +346,10 @@ def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(
settings=settings,
query=prs_query,
filter=f"repo:langchain-ai/langchain is:pr is:merged",
after=after
)
graphql_response = PullRequestResponse.model_validate(data)
return graphql_response.data.search.edges
graphql_response = PRsResponse.model_validate(data)
return graphql_response.data.repository.pullRequests.edges


# def get_issues_experts(settings: Settings):
Expand Down

0 comments on commit 8fcd9a4

Please sign in to comment.