First try at implementing only-apply-to-changed-files

This commit is contained in:
Amin Sadeghi
2024-04-04 14:40:34 -04:00
parent 47bc0821f5
commit 992901c201
2 changed files with 15 additions and 1 deletions
+6 -1
View File
@@ -11,6 +11,7 @@ ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"])
ARGS = os.getenv("INPUT_ARGS", default="")
SRC = os.getenv("INPUT_SRC", default="")
VERSION = os.getenv("INPUT_VERSION", default="")
CHANGED_FILES = os.getenv("CHANGED_FILES", "")
version_specifier = ""
if VERSION != "":
@@ -21,6 +22,10 @@ if VERSION != "":
req = f"ruff{version_specifier}"
proc = run(["pipx", "run", req, *shlex.split(ARGS), *shlex.split(SRC)])
# If CHANGED_FILES is not empty, split it into a list; otherwise, use SRC
files_to_check = shlex.split(CHANGED_FILES or SRC)
proc = run(["pipx", "run", req, *shlex.split(ARGS), *files_to_check])
# proc = run(["pipx", "run", req, *shlex.split(ARGS), *shlex.split(SRC)])
sys.exit(proc.returncode)