Skip to content

Commit dd2be57

Browse files
Update action.yml
Co-authored-by: LeAndre <lcjunior1220@gmail.com>
1 parent 0d3b5c9 commit dd2be57

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

action.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ inputs:
1111
required: true
1212

1313
file:
14-
description: "Optional file or directory passed to tox (if your tox.ini uses it)."
14+
description: "Optional file(s) or directory passed to tox as {posargs}."
1515
required: false
1616
default: ""
1717

1818
requirements:
19-
description: "Optional requirements file to install from (overrides requirements.txt)."
19+
description: "Optional comma-separated list of requirements files to install (overrides requirements.txt)."
2020
required: false
2121
default: ""
2222

@@ -40,9 +40,18 @@ runs:
4040
- name: Install project dependencies
4141
shell: bash
4242
run: |
43-
if [ -n "${{ inputs.requirements }}" ] && [ -f "${{ inputs.requirements }}" ]; then
44-
echo "Installing from matrix requirements file: ${{ inputs.requirements }}"
45-
pip install -r "${{ inputs.requirements }}"
43+
# If multiple requirement files are provided, split them by comma
44+
if [ -n "${{ inputs.requirements }}" ]; then
45+
IFS=',' read -ra reqs <<< "${{ inputs.requirements }}"
46+
for req in "${reqs[@]}"; do
47+
req_trimmed="$(echo "$req" | xargs)"
48+
if [ -f "$req_trimmed" ]; then
49+
echo "Installing from requirements file: $req_trimmed"
50+
pip install -r "$req_trimmed"
51+
else
52+
echo "Warning: requirements file '$req_trimmed' not found."
53+
fi
54+
done
4655
elif [ -f requirements.txt ]; then
4756
echo "Installing from default requirements.txt"
4857
pip install -r requirements.txt
@@ -54,4 +63,8 @@ runs:
5463
shell: bash
5564
run: |
5665
echo "Running tox."
57-
tox
66+
if [ -n "${{ inputs.file }}" ]; then
67+
tox -- ${{ inputs.file }}
68+
else
69+
tox
70+
fi

0 commit comments

Comments
 (0)