8000 Add PR Links as Task List Items to Issues by saadmk11 · Pull Request #518 · python/bedevere · GitHub
[go: up one dir, main page]

Skip to content

Add PR Links as Task List Items to Issues #518

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

Merged
merged 6 commits into from
Nov 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve RegEx
  • Loading branch information
saadmk11 committed Nov 8, 2022
commit 84fed9d116f569eec68949b51ea7a646d52c4e6a
7 changes: 4 additions & 3 deletions bedevere/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@

# Regex pattern to search for tasklist in the issue body
ISSUE_BODY_TASK_LIST_PATTERN = re.compile(
rf"(?P<start>{ISSUE_BODY_OPENING_TAG}\s*```\[tasklist]\s*)"
rf"(?P<tasks>.*?)(?P<end>\s*```\s*{ISSUE_BODY_CLOSING_TAG})",
rf"(?P<start>{ISSUE_BODY_OPENING_TAG}\s{{1,2}}```\[tasklist\])"
rf"(?P<tasks>.*?)"
rf"(?P<end>```\s{{1,2}}{ISSUE_BODY_CLOSING_TAG})",
flags=re.DOTALL
)

Expand Down Expand Up @@ -150,7 +151,7 @@ def build_issue_body(pr_number: int, body: str) -> str:

# If the body already contains a tasklist, only add the new PR to the list
return ISSUE_BODY_TASK_LIST_PATTERN.sub(
fr"\g<start>\g<tasks>\n- [ ] gh-{pr_number}\g<end>",
fr"\g<start>\g<tasks>- [ ] gh-{pr_number}\n\g<end>",
body
)

Expand Down
0