RaphCodec commented on code in PR #64422:
URL: https://github.com/apache/airflow/pull/64422#discussion_r3696688370


##########
providers/git/src/airflow/providers/git/hooks/git.py:
##########
@@ -127,6 +140,26 @@ def __init__(
                 AirflowProviderDeprecationWarning,
                 stacklevel=2,
             )
+        if (self.github_app_id is not None and self.github_installation_id is 
None) or (
+            self.github_app_id is None and self.github_installation_id is not 
None
+        ):
+            raise ValueError(
+                "Both 'github_app_id' and 'github_installation_id' must be 
provided to use GitHub App Authentication"
+            )
+        if self.github_app_id is not None and self.github_installation_id is 
not None:
+            if self.key_file and not self.private_key:
+                with open(self.key_file, encoding="utf-8") as key_file:
+                    self.private_key = key_file.read()
+            if not (self.repo_url or "").startswith(("https://";, "http://";)):
+                raise ValueError(
+                    f"GitHub App authentication requires an HTTPS repository 
URL, but got: {self.repo_url!r}"
+                )
+            # Store the PEM separately so configure_hook_env() does not treat 
it as an SSH key.
+            # Keep `private_key` populated for callers/tests that expect it to 
be available,
+            # but also keep a dedicated attribute so configure_hook_env() can 
avoid
+            # treating the GitHub App PEM as an SSH key.
+            self.github_app_private_key = self.private_key
+            self.auth_token = ""

Review Comment:
   I agree. I added a check to make sure the password field is empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to