From 313f11b209a3b79a8d4ada2022505a510d253a56 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Mon, 26 Aug 2024 21:15:06 +0900 Subject: [PATCH] feat: only extracting the last pull request --- src/data-collection/collect-linked-pulls.ts | 2 +- src/issue-activity.ts | 4 ++-- src/types/requests.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data-collection/collect-linked-pulls.ts b/src/data-collection/collect-linked-pulls.ts index df0d4061..4d077294 100644 --- a/src/data-collection/collect-linked-pulls.ts +++ b/src/data-collection/collect-linked-pulls.ts @@ -20,7 +20,7 @@ type IssueWithClosedByPRs = { }; }; -export async function collectLinkedMergedPulls(issue: IssueParams) { +export async function collectLinkedMergedPull(issue: IssueParams) { const octokit = getOctokitInstance(); const { owner, repo, issue_number } = issue; diff --git a/src/issue-activity.ts b/src/issue-activity.ts index 3e2ec213..e4cc68f9 100644 --- a/src/issue-activity.ts +++ b/src/issue-activity.ts @@ -1,7 +1,7 @@ import { CommentAssociation, CommentKind } from "./configuration/comment-types"; import configuration from "./configuration/config-reader"; import { DataCollectionConfiguration } from "./configuration/data-collection-config"; -import { collectLinkedMergedPulls } from "./data-collection/collect-linked-pulls"; +import { collectLinkedMergedPull } from "./data-collection/collect-linked-pulls"; import { GitHubIssue, GitHubIssueComment, @@ -47,7 +47,7 @@ export class IssueActivity { private async _getLinkedReviews(): Promise { logger.debug("Trying to fetch linked pull-requests for", this._issueParams); - const pulls = await collectLinkedMergedPulls(this._issueParams); + const pulls = await collectLinkedMergedPull(this._issueParams); logger.debug("Collected linked pull-requests", { pulls }); const promises = pulls .map(async (pull) => { diff --git a/src/types/requests.ts b/src/types/requests.ts index a209a45d..910db737 100644 --- a/src/types/requests.ts +++ b/src/types/requests.ts @@ -3,7 +3,7 @@ export const LINKED_PULL_REQUESTS = /* GraphQL */ ` repository(owner: $owner, name: $repo) { issue(number: $issue_number) { id - closedByPullRequestsReferences(first: 10, includeClosedPrs: false, after: $cursor) { + closedByPullRequestsReferences(first: 10, includeClosedPrs: false, after: $cursor, last: 1) { edges { node { id