Skip to content

Commit 4068cdf

Browse files
committed
Add better / more accurate error messages for classify_target and validate_exists
1 parent 2d45522 commit 4068cdf

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/action_tools/usage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def classify_target(target: str) -> Resource:
2929
repo=match.group("repo"),
3030
subpath=match.group("subpath"),
3131
)
32-
raise ValueError(f"target {target} does not appear to be a valid resource")
32+
raise ValueError(f"target {target} does not appear to be an action or workflow")
3333

3434

3535
def validate_exists(resource: Resource, client: github.Client) -> bool:
@@ -47,7 +47,10 @@ def validate_exists(resource: Resource, client: github.Client) -> bool:
4747
return any(file["name"] in {"action.yml", "action.yaml"} for file in contents)
4848
else:
4949
raise ValueError(
50-
f"invalid resource: {resource} does not appear to be a path to an action or workflow"
50+
f"Unsupported resource type or invalid path: expected a workflow or action at "
51+
f"{resource.org}/{resource.repo}/{resource.subpath}, but none was found. "
52+
"Ensure the path exists in the repository and contains a valid GitHub Action "
53+
"(with 'action.yml' or 'action.yaml') or a workflow file."
5154
)
5255

5356

0 commit comments

Comments
 (0)