From 3c973399692d290ddafd6ee4aeaf18ca8eb598a0 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 28 Nov 2024 00:08:30 +1100 Subject: [PATCH] fixes --- dist/index.js | 37 ++++++++++++++++--------------------- src/main.ts | 44 +++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 46 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7df96b5..d99fe9f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42891,6 +42891,22 @@ async function main({ isCurrent: true, ...pullRequest }); + (0, import_graphology_traversal.dfsFromNode)( + repoGraph, + pullRequest.head.ref, + (_, attributes) => { + if (attributes.type !== "pull-request") { + return false; + } + stackGraph2.mergeNode(attributes.head.ref, { + ...attributes, + shouldPrint: true + }); + stackGraph2.mergeDirectedEdge(attributes.base.ref, attributes.head.ref); + return true; + }, + { mode: "outbound" } + ); (0, import_graphology_traversal.bfsFromNode)( repoGraph, pullRequest.head.ref, @@ -42911,27 +42927,6 @@ async function main({ }, { mode: "inbound" } ); - (0, import_graphology_traversal.dfsFromNode)( - repoGraph, - pullRequest.head.ref, - (_, attributes) => { - if (attributes.type !== "pull-request") { - return false; - } - stackGraph2.mergeNode(attributes.head.ref, { - ...attributes, - shouldPrint: true - }); - stackGraph2.mergeDirectedEdge(attributes.base.ref, attributes.head.ref); - return true; - }, - { mode: "outbound" } - ); - stackGraph2.forEachNode((ref, stackNode) => { - if (!stackNode.shouldPrint) { - stackGraph2.dropNode(ref); - } - }); return stackGraph2; }; const getOutput = (graph) => { diff --git a/src/main.ts b/src/main.ts index 17eea29..9e1db08 100644 --- a/src/main.ts +++ b/src/main.ts @@ -76,6 +76,25 @@ export async function main({ ...pullRequest, }) + dfsFromNode( + repoGraph, + pullRequest.head.ref, + (_, attributes) => { + if (attributes.type !== 'pull-request') { + return false + } + + stackGraph.mergeNode(attributes.head.ref, { + ...attributes, + shouldPrint: true, + }) + stackGraph.mergeDirectedEdge(attributes.base.ref, attributes.head.ref) + + return true + }, + { mode: 'outbound' } + ) + bfsFromNode( repoGraph, pullRequest.head.ref, @@ -98,31 +117,6 @@ export async function main({ { mode: 'inbound' } ) - dfsFromNode( - repoGraph, - pullRequest.head.ref, - (_, attributes) => { - if (attributes.type !== 'pull-request') { - return false - } - - stackGraph.mergeNode(attributes.head.ref, { - ...attributes, - shouldPrint: true, - }) - stackGraph.mergeDirectedEdge(attributes.base.ref, attributes.head.ref) - - return true - }, - { mode: 'outbound' } - ) - - stackGraph.forEachNode((ref, stackNode) => { - if (!stackNode.shouldPrint) { - stackGraph.dropNode(ref) - } - }) - return stackGraph }