Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CloudNStoyan
Copy link

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

Run tgymnich/[email protected]
/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