Skip to content

Commit 48d5c50

Browse files
Merge pull request #714 from jiridanek/jd_useful_error
Issue #713: fix(gha): don't crash when branch name matches file name in the repo
2 parents 22e395c + c2e54f0 commit 48d5c50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ci/cached-builds/gha_pr_changed_files.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def get_github_token() -> str:
1616
def list_changed_files(from_ref: str, to_ref: str) -> list[str]:
1717
logging.debug("Getting list of changed files from git diff")
1818

19-
files = subprocess.check_output(["git", "diff", "--name-only", from_ref, to_ref],
19+
# https://github.com/red-hat-data-services/notebooks/pull/361: add -- in case to_ref matches a file name in the repo
20+
files = subprocess.check_output(["git", "diff", "--name-only", from_ref, to_ref, '--'],
2021
encoding='utf-8').splitlines()
2122

2223
logging.debug(f"Determined {len(files)} changed files: {files[:100]} (..., printing up to 100 files)")

0 commit comments

Comments
 (0)