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

[$500] deployBlocker.yml Workflow fails when an issue has a ' in the title #32070

Closed
AndrewGable opened this issue Nov 27, 2023 · 15 comments
Closed
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review Weekly KSv2

Comments

@AndrewGable
Copy link
Contributor

AndrewGable commented Nov 27, 2023

Problem

This line can fail when a GitHub issue has a ' in the title and it has the deploy blocker label applied to it:

text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>'.replace(/[&<>"'|]/g, function(m) { return {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;', '|': '&verbar;'}[m]; }),

It creates the following error:

Failing workflow

Run 8398a7/action-slack@v3
  with:
    status: custom
    custom_payload: {
    channel: '#expensify-open-source',
    attachments: [{
      color: "#DB4545",
      text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <https://github.com/Expensify/App/issues/3159[2](https://github.com/Expensify/App/actions/runs/6936763631/job/18869531998#step:4:2)|"Desktop - Reload - ''Hmm... it's not here'' when reloading the desktop app">',
    }]
  }
  
    author_name: 8[3](https://github.com/Expensify/App/actions/runs/6936763631/job/18869531998#step:4:3)98a[7](https://github.com/Expensify/App/actions/runs/6936763631/job/18869531998#step:4:7)@action-slack
    github_token: ***
  env:
    GITHUB_TOKEN: ***
    SLACK_WEBHOOK_URL: ***
Error: Unexpected string

Solution

Fix the bug so it does not error. Possibly we need to escape the ' or remove these characters from the title.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0110e529d76a12411d
  • Upwork Job ID: 1729227118965649408
  • Last Price Increase: 2023-11-27
@AndrewGable AndrewGable added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 27, 2023
@melvin-bot melvin-bot bot changed the title deployBlocker.yml Workflow fails when an issue has a ' in the title [$500] deployBlocker.yml Workflow fails when an issue has a ' in the title Nov 27, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0110e529d76a12411d

Copy link

melvin-bot bot commented Nov 27, 2023

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 27, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 27, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @cubuspl42 (External)

@paultsimura
Copy link
Contributor

paultsimura commented Nov 27, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

When a GH issue has a ' in the title, the deploy blocker workflow fails. Actually, the whole replacement is not working properly resulting in broken links:

image

What is the root cause of that problem?

We replace the symbols in the whole built string here:

text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>'.replace(/[&<>"'|]/g, function(m) { return {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;', '|': '&verbar;'}[m]; }),

But if the title has ' in it, the enclosing ' becomes an issue.

What changes do you think we should make in order to solve the problem?

We should move this replace function to be applied only to the issue title, not the whole string:

text: '💥 We have found a New Expensify Deploy Blocker, if you have any idea which PR could be causing this, please comment in the issue: <${{ github.event.issue.html_url }}|${{ github.event.issue.title.replace(/[&<>"'|]/g, function(m) { return {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#039;', '|': '&verbar;'}[m]; }) }}>',

What alternative solutions did you explore? (Optional)

@AndrewGable
Copy link
Contributor Author

Dupe of #31846, closing

@michaelssingh
Copy link

OK, so I am forked the repository and trying to test this myself but now everything is locked up because of Lock staging deploys during QA job, anyways I think we just need to figure out how to properly escape the '

    init │ n> '"<>&\''.replace(/[&<>|"']/g, (m) => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;', '\'': 'apostrophe;'}[m]))
jellobot │ (okay) '&quot;&lt;&gt;&amp;apostrophe;'

Copy link

melvin-bot bot commented Nov 28, 2023

📣 @michaelssingh! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@michaelssingh
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/michaelssingh

Copy link

melvin-bot bot commented Nov 28, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@ebauger
Copy link

ebauger commented Nov 28, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01ee2f0e8b16689ccb

Proposal

This line can fail when a GitHub issue has a ' in the title and it has the deploy blocker label applied to it:

What is the root cause of that problem?

Wrong string format in YAML for the workflow

What changes do you think we should make in order to solve the problem?

replace single quotes (') with backticks (`) in GitHub Actions workflow deployBlocker.yml on line 35.

What alternative solutions did you explore? (Optional)

The issue can be from this project: 8398a7/action-slack

Copy link

melvin-bot bot commented Nov 28, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 28, 2023
@ebauger
Copy link

ebauger commented Nov 28, 2023

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ee2f0e8b16689ccb

Proposal

This line can fail when a GitHub issue has a ' in the title and it has the deploy blocker label applied to it:

What is the root cause of that problem?

Wrong string format in YAML for the workflow

What changes do you think we should make in order to solve the problem?

replace single quotes (') with backticks () in GitHub Actions workflow deployBlocker.yml` on line 35.

What alternative solutions did you explore? (Optional)

The issue can be from this project: 8398a7/action-slack

PR : #32136

@paultsimura
Copy link
Contributor

paultsimura commented Nov 28, 2023

@ebauger please make sure you're familiar with the Contribution Guidelines.

This issue is closed, and you shouldn't create a PR until you're assigned to the issue.

@cubuspl42
Copy link
Contributor

cubuspl42 commented Nov 29, 2023

@ebauger

As I said on the PR, and like Pavlo already noticed, our process works differently. Thank you for your interest in Expensify! You can search for other issues open for proposals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants