|
18 | 18 | if TYPE_CHECKING: |
19 | 19 | from collections.abc import Set |
20 | 20 |
|
| 21 | +GITHUB_DEFAULT_BRANCH = os.environ.get("GITHUB_DEFAULT_BRANCH", "") |
21 | 22 | GITHUB_CODEOWNERS_PATH = Path(".github/CODEOWNERS") |
22 | 23 | GITHUB_WORKFLOWS_PATH = Path(".github/workflows") |
23 | 24 | CONFIGURATION_FILE_NAMES = frozenset({ |
@@ -80,7 +81,9 @@ def git_branches() -> tuple[str, str]: |
80 | 81 | return target_branch, head_branch |
81 | 82 |
|
82 | 83 |
|
83 | | -def get_changed_files(ref_a: str = "main", ref_b: str = "HEAD") -> Set[Path]: |
| 84 | +def get_changed_files( |
| 85 | + ref_a: str = GITHUB_DEFAULT_BRANCH, ref_b: str = "HEAD" |
| 86 | +) -> Set[Path]: |
84 | 87 | """List the files changed between two Git refs, filtered by change type.""" |
85 | 88 | args = ("git", "diff", "--name-only", f"{ref_a}...{ref_b}", "--") |
86 | 89 | print(*args) |
@@ -147,11 +150,8 @@ def process_target_branch(outputs: Outputs, git_branch: str) -> Outputs: |
147 | 150 | if not git_branch: |
148 | 151 | outputs.run_tests = True |
149 | 152 |
|
150 | | - # OSS-Fuzz maintains a configuration for fuzzing the main branch of |
151 | | - # CPython, so CIFuzz should be run only for code that is likely to be |
152 | | - # merged into the main branch; compatibility with older branches may |
153 | | - # be broken. |
154 | | - if git_branch != "main": |
| 153 | + # CIFuzz / OSS-Fuzz compatibility with older branches may be broken. |
| 154 | + if git_branch != GITHUB_DEFAULT_BRANCH: |
155 | 155 | outputs.run_ci_fuzz = False |
156 | 156 |
|
157 | 157 | if os.environ.get("GITHUB_EVENT_NAME", "").lower() == "workflow_dispatch": |
|
0 commit comments