-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
issue can't be closed if title length exceeds 80 characters #244
Comments
@alstr, this issue occurs in the client code, so the solution I have locally is just for GitLab. Once I'm ready to release the GitLab version, you can see how I've implemented the solution, in case you want to handle it the same way in |
Yes, that would be good to see. From memory if the URL insertion is enabled it should use that method to find an issue first, but then if not use title lookup. The limit is probably overly considervative; I think the GitHub issue title max length is actually 256 characters, so it could be increased also. GitLab is 255 apparently. |
Here's the diff from + # if title length is long, make sure we're searching using
+ # the exact same title as would've been inserted
+ search_title = issue.title + '...' if len(issue.title) > self.max_issue_title_length else issue.title
for existing_issue in self.existing_issues:
- if existing_issue['title'] == issue.title:
+ if existing_issue['title'] == search_title:
matched += 1
# If there are multiple issues with similar titles, don't try and close any.
if matched > 1:
- print(f'Skipping issue (multiple matches)')
+ print(f'Skipping issue closure due to ambiguous match against multiple existing issues, shown below')
+ for x in self.existing_issues:
+ if x['title'] == search_title:
+ print(f' {x["web_url"]}')
+ issue_number = None
break So, basically, there's a new variable The other item worth noting here is that I made the "multiple matches" error condition have more information to help the user. Take it or leave it, but if you use it, be sure to use the correct dictionary key to get the URL of the issue. (See second-to-last added line.) For GitLab, that's You'll also notice that it's referencing - title = title + '...' if len(title) > 80 else title
+ title = title + '...' if len(title) > self.max_issue_title_length else title |
One more thing: the last added line resets This is needed because if there are multiple matches, then you necessarily will have already gone through the loop at least one time and have already set |
Thanks for that, I'll look at updating |
When an issue is created and the title is long (> 80 characters), it is truncated and appended with
...
. When the issue is closed and a search is performed on the title, this truncation isn't accounted for, preventing the issue from being found and closed.The text was updated successfully, but these errors were encountered: