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

[NO QA] fix: action failure on invalid String in BASH #4049

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Jul 14, 2021

Please review @roryabraham

Details

#3600 (comment)

Fixed Issues

$ #3600

Need to be tested live.

@parasharrajat parasharrajat requested a review from a team as a code owner July 14, 2021 21:00
@MelvinBot MelvinBot requested review from tgolen and removed request for a team July 14, 2021 21:00
@@ -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,'\'') + '>',
Copy link
Contributor

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.

Copy link
Member Author

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();

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Member Author

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:

  1. I tested Yaml syntax which is valid.
  2. Github will pass the string as it is after replacing the placeholders.
  3. Now eval should parse the value. So I tested if the string is valid js syntax. Which it is after Gh action placeholders replacements.

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Used this for YAML validation.
  2. for the eval part you can use this https://jsbin.com/roxenoyibu/edit?js,console to test out strings.
  3. You can use [NO QA] fix: action failure on invalid String in BASH #4049 (comment) to get strings.

.github/workflows/deployBlocker.yml Show resolved Hide resolved
@roryabraham
Copy link
Contributor

Don't we also have to escape double-quotes?

@parasharrajat
Copy link
Member Author

@tgolen All yours. Thanks

Copy link
Contributor

@tgolen tgolen left a 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?

@tgolen tgolen merged commit c4a5c8b into Expensify:main Jul 19, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.79-5🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.80-2🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

5 participants