Skip to content

Commit

Permalink
Push to fork before checking for existing PR
Browse files Browse the repository at this point in the history
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 packit#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.
  • Loading branch information
jpopelka committed Sep 19, 2022
1 parent 0641b06 commit 6f71166
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6f71166

Please sign in to comment.