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

Error logging the issue number #46

Closed
lee-dohm opened this issue Mar 4, 2020 · 2 comments · Fixed by #47
Closed

Error logging the issue number #46

lee-dohm opened this issue Mar 4, 2020 · 2 comments · Fixed by #47

Comments

@lee-dohm
Copy link
Contributor

lee-dohm commented Mar 4, 2020

I have some automation in a private repo that uses this Action, so thank you for building it!

Starting seven days ago, my automation is running into a problem where the issue is created but the Action throws an error after that. Relevant log details:

ℹ  info      Creating new issue Completely fake issue title
✖  error     An error occurred while creating the issue. This might be caused by a malformed issue title, or a typo in the labels or assignees. Check .github/support-news-template.md!
✖  error     TypeError: (s || "").replace is not a function 
    at escapeData (/node_modules/@actions/core/lib/command.js:66:10)
    at Command.toString (/node_modules/@actions/core/lib/command.js:60:35)
    at Object.issueCommand (/node_modules/@actions/core/lib/command.js:23:30)
    at Object.setOutput (/node_modules/@actions/core/lib/core.js:88:15)
    at Toolkit.run (/index.js:49:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)

It took me a while to figure out what was going wrong because I thought that the issue creation was throwing the error but still succeeding somehow? But inside the catch statement you're calling the actions-toolkit logging infrastructure and the stack trace only shows the actions/toolkit code. So it would appear that this line is hitting the error:

core.setOutput('number', issue.data.number)

because it is the first line after the issue is created that calls into core.whatever. I suspect that issue.data.number is no longer returning a Number in all cases?

Let me know if you need more information.

@JasonEtco
Copy link
Owner

JasonEtco commented Mar 4, 2020

Thanks for opening this @lee-dohm! I'm guessing that core.setOutput needs to take a string, not a number, because it replaces spaces and stuff (apparently):

https://github.com/actions/toolkit/blob/6459481e988198bf53e186abf23350b085b1250f/packages/core/src/command.ts#L71-L81

So, it should probably be:

- core.setOutput('number', issue.data.number)
+ core.setOutput('number', String(issue.data.number))

If you're up for that PR that'd be great, if not I can do it!

@lee-dohm
Copy link
Contributor Author

lee-dohm commented Mar 4, 2020

I'll jump on it 👍

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 a pull request may close this issue.

2 participants