-
Notifications
You must be signed in to change notification settings - Fork 7
Sync to dist-git MR when source-git MR has been closed or reopened #62
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
This comment was marked as outdated.
This comment was marked as outdated.
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
This comment was marked as outdated.
This comment was marked as outdated.
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
We don't need the dist_git_branch variable because if the downstream branch doesn't exist none of the followup code is executed.
hardly/handlers/distgit.py
Outdated
if ( | ||
self.target_repo_branch | ||
not in self.packit.dg.local_project.git_project.get_branches() | ||
): | ||
msg = f"Downstream {self.target_repo}:{self.target_repo_branch} branch does not exist." | ||
self.project.get_pr(int(self.mr_identifier)).comment(msg) | ||
logger.info(msg) | ||
return TaskResults(success=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably put more text in the comment to guide contributors/maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in #56 and I don't think it'll happen too often because the source-git branches should in general match dist-git branches. But I tried to add more context to the message. Check the latest commit.
logger.error(f"Unknown action {self.action}") | ||
return TaskResults(success=False) | ||
logger.info(msg) | ||
self.dist_git_pr.comment(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope folks won't find this as spamming but it's totally significant to inform about such an action in the downstream PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and in most cases, you close the source-git MR only once, so it's just one comment.
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
Build succeeded. ✔️ pre-commit SUCCESS in 1m 40s |
"Can't create a dist-git pull/merge request out of this contribution " | ||
f"because matching {self.target_repo_branch} branch does not exist " | ||
f"in dist-git {self.target_repo} repo." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I need this for hardly, where we want to react when a source-git MR gets closed. packit/hardly#62
Build succeeded (gate pipeline). ✔️ pre-commit SUCCESS in 1m 39s |
Improve code added in #62 I initially wanted to attach these refactoring commits to some other PR, but I think they'll be better on their own. Reviewed-by: None <None> Reviewed-by: Jiri Popelka <None>
Fixes
Merge after