From 6f711669b869ecb35b31eb5f163497315691be27 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Wed, 14 Sep 2022 11:50:09 +0200 Subject: [PATCH] Push to fork before checking for existing PR Previously, when doing propose downstream, we checked for an already existing PR, and only if there was none, we pushed changes to a fork and created a new PR. Initially, the checking for already existing PR had been added in #994 in order to prevent creating multiple PRs if more propose-downstream jobs are triggered (packit/packit-service#785). This prevents us from updating an already existing PR (packit/hardly#76), so with this change, we first push to a fork, which might update an already existing PR, and then we check whether we actually need to create a new PR or if there already is one. --- packit/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packit/api.py b/packit/api.py index c5afd62b8..871145433 100644 --- a/packit/api.py +++ b/packit/api.py @@ -1069,10 +1069,11 @@ def push_and_create_pr( git_branch: str, repo: Union[Upstream, DistGit], ) -> PullRequest: + # the branch may already be up, let's push forcefully + repo.push_to_fork(repo.local_project.ref, force=True) + pr = repo.existing_pr(pr_title, pr_description.rstrip(), git_branch) if pr is None: - # the branch may already be up, let's push forcefully - repo.push_to_fork(repo.local_project.ref, force=True) pr = repo.create_pull( pr_title, pr_description,