potiuk commented on code in PR #63973:
URL: https://github.com/apache/airflow/pull/63973#discussion_r2964887996
##########
scripts/ci/prek/check_execution_api_versions.py:
##########
@@ -40,7 +40,7 @@
def get_changed_files_ci() -> list[str]:
"""Get changed files in CI by comparing against main."""
fetch_result = subprocess.run(
- ["git", "fetch", "upstream", TARGET_BRANCH],
+ ["git", "fetch", "origin", TARGET_BRANCH],
Review Comment:
I think we already have a code that checks the remotes in the repo and find
one with "apache/airflow" - it should be used instead, I tink we have no
standard for naming the remotes (except in providers's documentaiton I create a
separate remote with read-only https to make absolutely sure we check if there
are no new changes) .
This is the - code - it's currently in `breeze ` - but might be a good idea
to refactor and extract it to a separate method and also have similar code in
prek utils (we have a little duplication between breeze and prek utils but I
think it's quite ok as long as we have almost the same methods here and there.
```python
# Check if we have the apache remote and get its name
remote_result = run_command(["git", "remote", "-v"],
capture_output=True, text=True, check=False)
apache_remote_name = None
origin_remote_name = None
origin_repo = None # Store the user's fork repo (e.g.,
"username/airflow")
if remote_result.returncode == 0:
# Parse remote output to find apache/airflow remote and origin remote
# Format: remote_name\turl (fetch|push)
for line in remote_result.stdout.splitlines():
parts = line.split()
if len(parts) >= 2:
remote_name = parts[0]
remote_url = parts[1]
if "apache/airflow" in remote_url and apache_remote_name is
None:
apache_remote_name = remote_name
# Also track origin remote for pushing
if remote_name == "origin" and origin_remote_name is None:
origin_remote_name = remote_name
# Extract repo from origin URL (supports both HTTPS and
SSH formats)
# HTTPS: https://github.com/username/airflow.git
# SSH: [email protected]:username/airflow.git
if "github.com" in remote_url:
if "[email protected]:" in remote_url:
# SSH format
repo_part =
remote_url.split("[email protected]:")[1]
elif "github.com/" in remote_url:
# HTTPS format
repo_part = remote_url.split("github.com/")[1]
else:
repo_part = None
if repo_part:
# Remove .git suffix if present
origin_repo = repo_part.replace(".git",
"").strip()
````
--
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]