Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tranhl committed Nov 27, 2024
1 parent b917c0a commit 3c97339
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 46 deletions.
37 changes: 16 additions & 21 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand Down
44 changes: 19 additions & 25 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}

Expand Down

0 comments on commit 3c97339

Please sign in to comment.