Repository: packit-service/packit
Pull request #622 (2019-12-05 10:42:13)

create-pr defaults to True
- Creating of the pagure pull-requests are turned-on by default.

softwarefactory-project-zuul[bot]: Build failed.

- [packit-pre-commit ](https://softwarefactory-project.io/zuul/t/local/build/e734149a676b4f29b6c52412e4dc3a79) : SUCCESS in 1m 53s
- [packit-tests-rpm ](https://softwarefactory-project.io/zuul/t/local/build/d2eecde0378541f6bb7acee9ffdb0434) : FAILURE in 4m 56s
- [packit-tests-pip-deps ](https://softwarefactory-project.io/zuul/t/local/build/8e2fa424f37c4f0a9d0ab271f7ac2299) : FAILURE in 4m 11s
- [packit-tests-git-master ](https://softwarefactory-project.io/zuul/t/local/build/9aa5952603bf45fead07b4c958e4bf28) : FAILURE in 4m 47s
- [packit-tests-rpm-sess-rec ](https://softwarefactory-project.io/zuul/t/local/build/187f56e27e894cf794ac8353de55fb34) : SUCCESS in 1m 56s
- [packit-tests-pip-deps-sess-rec ](https://softwarefactory-project.io/zuul/t/local/build/850d347fe55a4f4dbe2994db8ebf0b24) : SUCCESS in 2m 37s
- [packit-tests-git-master-sess-rec ](https://softwarefactory-project.io/zuul/t/local/build/c24fbd29e0ae4cb9969b676628572842) : SUCCESS in 2m 25s

packit-as-a-service[bot]: Congratulations! The build [has finished](https://copr-be.cloud.fedoraproject.org/results/packit/packit-service-packit-622/fedora-rawhide-x86_64/01124313-packit/builder-live.log.gz) successfully. :champagne:

You can install the built RPMs by following these steps:

* `sudo yum install -y dnf-plugins-core` on RHEL 8
* `sudo dnf install -y dnf-plugins-core` on Fedora
* `dnf copr enable packit/packit-service-packit-622`
* And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Patch:
diff --git a/packit/api.py b/packit/api.py
index d0eb3bd3..26708bb3 100644
--- a/packit/api.py
+++ b/packit/api.py
@@ -178,7 +178,7 @@ class PackitAPI:
         self.up.allowed_gpg_keys = self.dg.get_allowed_gpg_keys_from_downstream_config()
 
         upstream_ref = upstream_ref or self.package_config.upstream_ref
-        create_pr = create_pr or self.package_config.create_pr
+        create_pr = create_pr and self.package_config.create_pr
         self.up.run_action(actions=ActionName.post_upstream_clone)
 
         full_version = version or self.up.get_version()
diff --git a/packit/config/package_config.py b/packit/config/package_config.py
index 3b236f80..cb171757 100644
--- a/packit/config/package_config.py
+++ b/packit/config/package_config.py
@@ -64,7 +64,7 @@ class PackageConfig(BaseConfig):
         actions: Dict[ActionName, Union[str, List[str]]] = None,
         upstream_ref: Optional[str] = None,
         allowed_gpg_keys: Optional[List[str]] = None,
-        create_pr: bool = False,
+        create_pr: bool = True,
         spec_source_id: str = "Source0",
         upstream_tag_template: str = "{version}",
     ):
@@ -184,7 +184,7 @@ class PackageConfig(BaseConfig):
         upstream_ref = raw_dict.get("upstream_ref")
 
         allowed_gpg_keys = raw_dict.get("allowed_gpg_keys")
-        create_pr = raw_dict.get("create_pr", False)
+        create_pr = raw_dict.get("create_pr", True)
         upstream_tag_template = raw_dict.get("upstream_tag_template", "{version}")
 
         # it can be int as well


Test patch:
diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py
index f6394e3c..b7f441d3 100644
--- a/tests/unit/test_config.py
+++ b/tests/unit/test_config.py
@@ -508,7 +508,7 @@ def test_get_package_config_from_repo(content):
             SyncFilesItem(src=".packit.yaml", dest=".packit2.yaml"),
         ]
     )
-    assert not config.create_pr
+    assert config.create_pr
 
 
 def test_get_user_config(tmpdir):