Jie211 opened a new pull request, #72865: URL: https://github.com/apache/airflow/pull/72865
### Purpose Two fixes for the GitHub App authentication that #64422 added to the `git` provider. #### 1. It only works on github.com `_get_github_app_token()` calls `GithubIntegration(auth=auth)` with no `base_url`, so PyGithub uses its default, `https://api.github.com`. That URL only gives tokens for github.com repositories. GitHub Enterprise Server serves its REST API at `https://HOSTNAME/api/v3`, so the feature fails there. This PR adds a `github_api_url` connection extra and passes it as `base_url`. The hook does not guess the value, because the API host does not always follow the repository host. The `github` provider also takes this URL from the connection. github.com needs no new setting. The extra defaults to `https://api.github.com`, the value PyGithub used before. For another host the hook now raises when the connection is created, instead of sending the request to the wrong API. #### 2. A GitHub App connection shows an SSH warning `_uses_ssh_transport_options()` returns `True` when `key_file` or `private_key` has a value. Before #64422 only SSH keys used these extras. #64422 puts the GitHub App PEM key there too, but GitHub App authentication uses HTTPS only. So the hook warns about `known_hosts_file` and `strict_host_key_checking`, which do nothing over HTTPS. Every GitHub App test in #64422 had to wrap this warning in `pytest.warns(...)`. The method now returns `False` for a GitHub App connection, and those tests check that no warning appears. --- related: #64422 --- ##### Was generative AI tooling used to co-author this PR? <!-- If generative AI tooling has been used in the process of authoring this PR, please change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by". --> - [X] Yes (please specify the tool below) <!-- Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) --> --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged. * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number. -- 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]
