Skip to content

Don't add ref to node graph if it already exists #19

@tranhl

Description

@tranhl

Adding a ref (e.g. main) to the branch graph will cause a runtime error:

Run git-town/action@v1
/home/runner/work/_actions/git-town/action/v1/dist/index.js:2[4](https://github.com/connecX/monorepo/actions/runs/8963195676/job/24613133789?pr=557#step:3:5)845
        throw new UsageGraphError('Graph.addNode: the "'.concat(node2, '" node already exist in the graph.'));
              ^

UsageGraphError2: Graph.addNode: the "main" node already exist in the graph.
    at _addNode (/home/runner/work/_actions/git-town/action/v1/dist/index.js:2484[5](https://github.com/connecX/monorepo/actions/runs/8963195676/job/24613133789?pr=557#step:3:6):15)
    at MultiDirectedGraph3.addNode (/home/runner/work/_actions/git-town/action/v1/dist/index.js:25574:24)
    at /home/runner/work/_actions/git-town/action/v1/dist/index.js:42854:15
    at Array.forEach (<anonymous>)
    at main (/home/runner/work/_actions/git-town/action/v1/dist/index.js:42853:1[6](https://github.com/connecX/monorepo/actions/runs/8963195676/job/24613133789?pr=557#step:3:7))
    at run (/home/runner/work/_actions/git-town/action/v1/dist/index.js:46955:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:[9](https://github.com/connecX/monorepo/actions/runs/8963195676/job/24613133789?pr=557#step:3:10)5:5)

We should check whether the ref exists as a node in the graph first before adding it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions