Skip to content

Conversation

@lbarcziova
Copy link
Member

Fixes #2866

RELEASE NOTES BEGIN

For retriggering tests with builds from another pull request, Packit now supports Github's automatically converted URL format (https://github.com/namespace/repo/pull/<pr_id>, e.g. /packit test https://github.com/namespace/repo/pull/<pr_id>)

RELEASE NOTES END

@lbarcziova lbarcziova requested a review from a team as a code owner January 2, 2026 10:32
@lbarcziova lbarcziova requested review from betulependule and removed request for a team January 2, 2026 10:32
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for parsing GitHub's auto-formatted pull request URLs when retriggering tests, which is a great enhancement. The implementation is straightforward and includes relevant test cases. I have one suggestion to improve the code's efficiency and readability by avoiding a redundant regular expression match.

@centosinfra-prod-github-app

This comment was marked as outdated.

@centosinfra-prod-github-app

This comment was marked as outdated.

@lbarcziova lbarcziova force-pushed the retriggering-another-pr-format branch from 682d0be to e207ae4 Compare January 2, 2026 12:01
@centosinfra-prod-github-app
Copy link
Contributor

Comment on lines 140 to +141
pr_argument_pattern = re.compile(r"^[^/\s]+/[^#\s]+#\d+$")
github_url_pattern = re.compile(r"^https://github\.com/([^/\s]+)/([^/\s]+)/pull/(\d+)$")
Copy link
Member

Choose a reason for hiding this comment

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

Probably wouldn't be a bad idea to have one regex for both, since you can capture what you need from both;

Copy link
Member

Choose a reason for hiding this comment

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

Additionally it wouldn't be that bad of an idea to compile the regex(es) only once, e.g., in constants?

Copy link
Member

Choose a reason for hiding this comment

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

https://regex101.com/r/sX7EJU/1

Note

  1. I dropped the ^ and $ for boundaries, since it didn't work well with whole comments I copy-pasted
  2. Also used named capture groups, since the alternatives must also be enclosed in parentheses and therefore make a capture group, haven't checked the Python docs, but I ticked the Python syntax on that web, so it should be allowed.

self.pr_argument = arg
logger.debug(f"Parsed pr_argument: {self.pr_argument}")
break
if match := github_url_pattern.match(arg):
Copy link
Member

Choose a reason for hiding this comment

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

We support this only for GitHub?


Or GitHub is the only “UX-friendly” enough to do this crap?


am afraid I know the answers to those two questions sigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: new

Development

Successfully merging this pull request may close these issues.

Retriggering tests with builds from another pull request using GitHub url

2 participants