22
33import os
44import subprocess
5+ import sys
56from dataclasses import dataclass
67from collections .abc import Set
78from pathlib import Path
@@ -26,9 +27,9 @@ class Outputs:
2627 run_win_msi : bool = False
2728
2829
29- def compute_changes ():
30+ def compute_changes (ref_a : str = "main" , ref_b : str = "HEAD" ):
3031 target_branch = get_git_base_branch ()
31- changed_files = get_changed_files ()
32+ changed_files = get_changed_files (ref_a , ref_b )
3233 outputs = process_changed_files (changed_files )
3334 outputs = process_target_branch (outputs , target_branch )
3435
@@ -54,7 +55,7 @@ def compute_changes():
5455 write_github_output (outputs )
5556
5657
57- def get_changed_files (ref_a : str = "main" , ref_b : str = "HEAD" ) -> Set [Path ]:
58+ def get_changed_files (ref_a : str , ref_b : str ) -> Set [Path ]:
5859 """List the files changed between two Git refs, filtered by change type."""
5960 changed_files_result = subprocess .run (
6061 ("git" , "diff" , "--name-only" , f"{ ref_a } ...{ ref_b } " , "--" ),
@@ -176,4 +177,9 @@ def bool_lower(value: bool, /) -> str:
176177
177178
178179if __name__ == "__main__" :
179- compute_changes ()
180+ try :
181+ base_ref , pr_ref = sys .argv [1 :3 ]
182+ except ValueError :
183+ compute_changes ()
184+ else :
185+ compute_changes (base_ref , pr_ref )
0 commit comments