-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[NO QA] fix: action failure on invalid String in BASH #4049
Conversation
@@ -54,7 +54,7 @@ jobs: | |||
channel: '#deployer', | |||
attachments: [{ | |||
color: "#DB4545", | |||
text: '💥 New E.cash Deploy Blocker: <${{ env.DEPLOY_BLOCKER_URL }}|${{ env.DEPLOY_BLOCKER_TITLE }}>', | |||
text: '💥 New E.cash Deploy Blocker: <${{ env.DEPLOY_BLOCKER_URL }}|'+ `${{ env.DEPLOY_BLOCKER_TITLE }}`.replace(/(^'|'$)/gi, '').replace(/'\''/gi,'\'') + '>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm I don't think this is likely to work? This isn't a JS string, it's using the expression syntax for GH actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at here https://action-slack.netlify.app/with#custom_payload example. We can use js.
I checked the action code its is using eval()
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use js
Whoa, that's a nice feature of action-slack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah totally agree, despite the use of eval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also show me what local testing you did for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is untested apart from the js code which I tested so that it gives us the original string.
I am not too sure about the + usages here. It could be the problem. But I feel it will work based on these:
- I tested Yaml syntax which is valid.
- Github will pass the string as it is after replacing the placeholders.
- Now eval should parse the value. So I tested if the string is valid js syntax. Which it is after Gh action placeholders replacements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me the tests you did for the JS replacement portion? Even just using a Node.js REPL and some sample strings to demonstrate how the replacement works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Used this for YAML validation.
- for the eval part you can use this https://jsbin.com/roxenoyibu/edit?js,console to test out strings.
- You can use [NO QA] fix: action failure on invalid String in BASH #4049 (comment) to get strings.
Don't we also have to escape double-quotes? |
@tgolen All yours. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, I'll go ahead and approve. Sounds like the regex stuff was sorted out. I assume you'll keep an eye on this as it gets deployed?
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging in version: 1.0.79-5🚀
|
🚀 Deployed to production in version: 1.0.80-2🚀
|
Please review @roryabraham
Details
#3600 (comment)
Fixed Issues
$ #3600
Need to be tested live.