Skip to content

Commit 6795a27

Browse files
committed
allow passing manifest-path to the action
1 parent 0bb207d commit 6795a27

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

action.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ inputs:
1717
Time machine for testing
1818
required: false
1919
type: string
20+
manifest-path: >-
21+
description: >-
22+
Path to the manifest file of `pixi`. Required for `pixi` environments.
23+
required: false
24+
type: string
2025
outputs: {}
21-
2226
runs:
2327
using: "composite"
2428

@@ -38,8 +42,10 @@ runs:
3842
POLICY_PATH: ${{ inputs.policy }}
3943
ENVIRONMENT_PATHS: ${{ inputs.environment-paths }}
4044
TODAY: ${{ inputs.today }}
45+
MANIFEST_PATH: ${{ inputs.manifest-path }}
4146
run: |
4247
python -m minimum_versions validate \
4348
--today="$TODAY" \
4449
--policy="$POLICY_PATH" \
50+
--manifest-path="$MANIFEST_PATH" \
4551
$ENVIRONMENT_PATHS

minimum_versions/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os.path
33
import pathlib
44
import sys
5+
from typing import Any
56

67
import rich_click as click
78
from rich.console import Console
@@ -24,6 +25,16 @@ def parse_date(string):
2425
return datetime.datetime.strptime(string, "%Y-%m-%d").date()
2526

2627

28+
class _Path(click.Path):
29+
def convert(
30+
self, value: Any, param: click.Parameter | None, ctx: click.Context | None
31+
) -> Any:
32+
if not value:
33+
return None
34+
35+
return super().convert(value, param, ctx)
36+
37+
2738
@click.group()
2839
def main():
2940
pass
@@ -34,7 +45,7 @@ def main():
3445
@click.option(
3546
"--manifest-path",
3647
"manifest_path",
37-
type=click.Path(exists=True, path_type=pathlib.Path),
48+
type=_Path(exists=True, path_type=pathlib.Path),
3849
default=None,
3950
)
4051
@click.option("--today", type=parse_date, default=None)

0 commit comments

Comments
 (0)