Skip to content

Fix action failing because it doesn't read the correct error#188

Open
CloudNStoyan wants to merge 1 commit into
tgymnich:masterfrom
CloudNStoyan:master
Open

Fix action failing because it doesn't read the correct error#188
CloudNStoyan wants to merge 1 commit into
tgymnich:masterfrom
CloudNStoyan:master

Conversation

@CloudNStoyan
Copy link
Copy Markdown

Currently when there is already a PR created and the action is ran the following error occurs:

Run tgymnich/fork-sync@v2.0
/home/runner/work/_actions/tgymnich/fork-sync/v2.0/lib/main.js:85
            console.log(error.errors[0].message);
                                    ^

TypeError: Cannot read properties of undefined (reading '0')
    at run (/home/runner/work/_actions/tgymnich/fork-sync/v2.0/lib/main.js:85:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.13.1

The problem was this line:

console.log(error.errors[0].message);

Which tries to get the error from the wrong place, which I fixed by just copying the above IF statement's way of extracting the error message

I tested it on my repo and now the action doesn't fail when the PR is already created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant