-
Notifications
You must be signed in to change notification settings - Fork 959
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
Cannot use ${{ toJson(github) }} when a ' appears in the commit message. #1656
Comments
Hi @petersutter5, thank you for submitting this issue! We are reproducing this issue now and we will get back to you as soon as we can. |
Hi @petersutter5, I reproduced the issue. toJSON will create a JSON object, and since ' is a valid thing to be inside the name (strings are enclosed using "), it will not be escaped. Now, if you are using an expression like One suggestion can be to pass in the context as env variable, and then printing or using it would not cause an issue:
This is a bash error, and you can take advantage of bash's built-in escaping of env variables to solve the problem like in the workflow above. |
This works. Thank you very much for the answer! |
I encountered this same issue. I am outputting the github object but it can be quite large and I am concerned with assigning the JSON text to an environment variable because of the risk of exceeding the max size. It would be nice if there were a "replace" function that could be used like this: |
@nikola-jokic , thanks for the workaround, but |
with this special character in their description "`" Solution found here: actions/runner#1656 (comment)
with this special character in their description "`" and "'" Solution found here: actions/runner#1656 (comment)
taken from actions/runner#1656
📚👋 Hey @atsu85, just a quick follow up from GitHub's documentation team.
We just merged some changes to this example which should fix the issue in question. Setting the contexts as an environment variable helps mitigate the We always welcome any contributions, check out our contribution guidelines. |
…metadata-action step see this issue for more info: actions/runner#1656
…metadata-action step see this issue for more info: actions/runner#1656
Describe the bug
When trying to use ${{ toJson(github) }} when there is a ' in the commit message, you get an error. The error looks like,
unexpected EOF while looking for matching `"'
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected to see the full pretty printed github context
Runner Version and Platform
Current runner version: '2.287.1'
OS of the machine running the runner? OSX/Windows/Linux/...
Ubuntu
20.04.3
LTS
What's not working?
toJson expression
Job Log Output
unexpected EOF while looking for matching `"'
The text was updated successfully, but these errors were encountered: