prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Removing comments from PR does not work
  ## 🐛 Bug
  After merging it looks like the action for removing comments does not work. 
  
  I will be happy to fast merge potential bugfix without the standard 24 hours as it needs to be merged to test. 
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `tools/remove_html_comments_from_pr.py`
  Content:
  ```
  1 """
  2 Edit pull request description to remove HTML comments
  3 
  4 We might want to remove section with markdown task lists that are completely empty
  5 """
  6 
  7 import re
  8 import sys
  9 from os import environ
  10 
  11 import requests
  12 
  13 
  14 def remove_html_comments(text):
  15     # Regular expression to remove HTML comments
  16     # [^\S\r\n] is whitespace but not new line
  17     html_comment_pattern = r"[^\S\r\n]*<!--(.*?)-->[^\S\r\n]*\n?"
  18     return re.sub(html_comment_pattern, "", text, flags=re.DOTALL)
  19 
  20 
  21 def edit_pull_request_description(repo, pull_request_number, access_token):
  22     # GitHub API base URL
  23     base_url = "https://api.github.com"
  24 
  25     # Prepare the headers with the access token
  26     headers = {"Authorization": f"token {access_token}"}
  27 
  28     # Get the current pull request description
  29     pr_url = f"{base_url}/repos/{repo}/pulls/{pull_request_number}"
  30     response = requests.get(pr_url, headers=headers)
  31     response.raise_for_status()
  32     response_json = response.json()
  33     current_description = response_json["body"]
  34 
  35     # Remove HTML comments from the description
  36     edited_description = remove_html_comments(current_description)
  37     if edited_description == current_description:
  38         print("No HTML comments found in the pull request description")
  39         return
  40 
  41     # Update the pull request description
  42     update_pr_url = f"{base_url}/repos/{repo}/pulls/{pull_request_number}"
  43     payload = {"body": edited_description}
  44     response = requests.patch(update_pr_url, json=payload, headers=headers)
  45     response.raise_for_status()
  46 
  47     if response.status_code == 200:
  48         print(
  49             f"Pull request #{pull_request_number} description has been updated successfully!"
  50         )
  51     else:
  52         print(
  53             f"Failed to update pull request description. Status code: {response.status_code}"
  54         )
  55 
  56 
  57 if __name__ == "__main__":
  58     # Replace with your repository and pull request number
  59     # get cuurrent repository name from github actions
  60     repository_name = environ.get("GITHUB_REPOSITORY")
  61     if repository_name == "napari/napari":
  62         sys.exit(0)
  63 
  64     # get current PR number from github actions
  65     github_ref = environ.get("GITHUB_REF")
  66     refs, pull, number, merge = github_ref.split('/')
  67     assert refs == 'refs'
  68     assert pull == 'pull'
  69     assert merge == 'merge'
  70 
  71     # Replace with your GitHub access token
  72     access_token = environ.get("GITHUB_TOKEN")
  73 
  74     edit_pull_request_description(repository_name, number, access_token)
  75
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/tools/remove_html_comments_from_pr.py b/tools/remove_html_comments_from_pr.py
  --- a/tools/remove_html_comments_from_pr.py
  +++ b/tools/remove_html_comments_from_pr.py
  @@ -10,6 +10,8 @@
   
   import requests
   
  +REPO = 'napari/napari'
  +
   
   def remove_html_comments(text):
       # Regular expression to remove HTML comments
  @@ -55,10 +57,12 @@
   
   
   if __name__ == "__main__":
  +    print('Will inspect PR description to remove html comments.')
       # Replace with your repository and pull request number
       # get cuurrent repository name from github actions
       repository_name = environ.get("GITHUB_REPOSITORY")
  -    if repository_name == "napari/napari":
  +    if repository_name != REPO:
  +        print('Not on main repo, aborting with success')
           sys.exit(0)
   
       # get current PR number from github actions
  
verification_info: {"golden_diff": "diff --git a/tools/remove_html_comments_from_pr.py b/tools/remove_html_comments_from_pr.py\n--- a/tools/remove_html_comments_from_pr.py\n+++ b/tools/remove_html_comments_from_pr.py\n@@ -10,6 +10,8 @@\n \n import requests\n \n+REPO = 'napari/napari'\n+\n \n def remove_html_comments(text):\n     # Regular expression to remove HTML comments\n@@ -55,10 +57,12 @@\n \n \n if __name__ == \"__main__\":\n+    print('Will inspect PR description to remove html comments.')\n     # Replace with your repository and pull request number\n     # get cuurrent repository name from github actions\n     repository_name = environ.get(\"GITHUB_REPOSITORY\")\n-    if repository_name == \"napari/napari\":\n+    if repository_name != REPO:\n+        print('Not on main repo, aborting with success')\n         sys.exit(0)\n \n     # get current PR number from github actions\n", "issue": "Removing comments from PR does not work\n## \ud83d\udc1b Bug\r\nAfter merging it looks like the action for removing comments does not work. \r\n\r\nI will be happy to fast merge potential bugfix without the standard 24 hours as it needs to be merged to test. \r\n\n", "before_files": [{"content": "\"\"\"\nEdit pull request description to remove HTML comments\n\nWe might want to remove section with markdown task lists that are completely empty\n\"\"\"\n\nimport re\nimport sys\nfrom os import environ\n\nimport requests\n\n\ndef remove_html_comments(text):\n    # Regular expression to remove HTML comments\n    # [^\\S\\r\\n] is whitespace but not new line\n    html_comment_pattern = r\"[^\\S\\r\\n]*<!--(.*?)-->[^\\S\\r\\n]*\\n?\"\n    return re.sub(html_comment_pattern, \"\", text, flags=re.DOTALL)\n\n\ndef edit_pull_request_description(repo, pull_request_number, access_token):\n    # GitHub API base URL\n    base_url = \"https://api.github.com\"\n\n    # Prepare the headers with the access token\n    headers = {\"Authorization\": f\"token {access_token}\"}\n\n    # Get the current pull request description\n    pr_url = f\"{base_url}/repos/{repo}/pulls/{pull_request_number}\"\n    response = requests.get(pr_url, headers=headers)\n    response.raise_for_status()\n    response_json = response.json()\n    current_description = response_json[\"body\"]\n\n    # Remove HTML comments from the description\n    edited_description = remove_html_comments(current_description)\n    if edited_description == current_description:\n        print(\"No HTML comments found in the pull request description\")\n        return\n\n    # Update the pull request description\n    update_pr_url = f\"{base_url}/repos/{repo}/pulls/{pull_request_number}\"\n    payload = {\"body\": edited_description}\n    response = requests.patch(update_pr_url, json=payload, headers=headers)\n    response.raise_for_status()\n\n    if response.status_code == 200:\n        print(\n            f\"Pull request #{pull_request_number} description has been updated successfully!\"\n        )\n    else:\n        print(\n            f\"Failed to update pull request description. Status code: {response.status_code}\"\n        )\n\n\nif __name__ == \"__main__\":\n    # Replace with your repository and pull request number\n    # get cuurrent repository name from github actions\n    repository_name = environ.get(\"GITHUB_REPOSITORY\")\n    if repository_name == \"napari/napari\":\n        sys.exit(0)\n\n    # get current PR number from github actions\n    github_ref = environ.get(\"GITHUB_REF\")\n    refs, pull, number, merge = github_ref.split('/')\n    assert refs == 'refs'\n    assert pull == 'pull'\n    assert merge == 'merge'\n\n    # Replace with your GitHub access token\n    access_token = environ.get(\"GITHUB_TOKEN\")\n\n    edit_pull_request_description(repository_name, number, access_token)\n", "path": "tools/remove_html_comments_from_pr.py"}], "after_files": [{"content": "\"\"\"\nEdit pull request description to remove HTML comments\n\nWe might want to remove section with markdown task lists that are completely empty\n\"\"\"\n\nimport re\nimport sys\nfrom os import environ\n\nimport requests\n\nREPO = 'napari/napari'\n\n\ndef remove_html_comments(text):\n    # Regular expression to remove HTML comments\n    # [^\\S\\r\\n] is whitespace but not new line\n    html_comment_pattern = r\"[^\\S\\r\\n]*<!--(.*?)-->[^\\S\\r\\n]*\\n?\"\n    return re.sub(html_comment_pattern, \"\", text, flags=re.DOTALL)\n\n\ndef edit_pull_request_description(repo, pull_request_number, access_token):\n    # GitHub API base URL\n    base_url = \"https://api.github.com\"\n\n    # Prepare the headers with the access token\n    headers = {\"Authorization\": f\"token {access_token}\"}\n\n    # Get the current pull request description\n    pr_url = f\"{base_url}/repos/{repo}/pulls/{pull_request_number}\"\n    response = requests.get(pr_url, headers=headers)\n    response.raise_for_status()\n    response_json = response.json()\n    current_description = response_json[\"body\"]\n\n    # Remove HTML comments from the description\n    edited_description = remove_html_comments(current_description)\n    if edited_description == current_description:\n        print(\"No HTML comments found in the pull request description\")\n        return\n\n    # Update the pull request description\n    update_pr_url = f\"{base_url}/repos/{repo}/pulls/{pull_request_number}\"\n    payload = {\"body\": edited_description}\n    response = requests.patch(update_pr_url, json=payload, headers=headers)\n    response.raise_for_status()\n\n    if response.status_code == 200:\n        print(\n            f\"Pull request #{pull_request_number} description has been updated successfully!\"\n        )\n    else:\n        print(\n            f\"Failed to update pull request description. Status code: {response.status_code}\"\n        )\n\n\nif __name__ == \"__main__\":\n    print('Will inspect PR description to remove html comments.')\n    # Replace with your repository and pull request number\n    # get cuurrent repository name from github actions\n    repository_name = environ.get(\"GITHUB_REPOSITORY\")\n    if repository_name != REPO:\n        print('Not on main repo, aborting with success')\n        sys.exit(0)\n\n    # get current PR number from github actions\n    github_ref = environ.get(\"GITHUB_REF\")\n    refs, pull, number, merge = github_ref.split('/')\n    assert refs == 'refs'\n    assert pull == 'pull'\n    assert merge == 'merge'\n\n    # Replace with your GitHub access token\n    access_token = environ.get(\"GITHUB_TOKEN\")\n\n    edit_pull_request_description(repository_name, number, access_token)\n", "path": "tools/remove_html_comments_from_pr.py"}]}