Skip to content

Commit 2135c4b

Browse files
test: add test case to validate action input edge cases
1 parent 6800277 commit 2135c4b

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,33 @@ jobs:
151151
python3 --version
152152
python --version
153153
154-
python3 --version 2>&1 | grep -F "3.13"
154+
python3 --version 2>&1 | grep -F "3.13"
155+
156+
test_invalid_action_input:
157+
runs-on: ubuntu-latest
158+
container: amazonlinux:2023
159+
steps:
160+
- name: Setup runner
161+
run: |
162+
yum install -y git sudo tar gzip which
163+
164+
- name: Checkout
165+
run: |
166+
git clone --depth 1 -b "${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" "https://github.com/${GITHUB_REPOSITORY}.git" .
167+
168+
- name: Install python
169+
id: test-installation
170+
continue-on-error: true
171+
uses: ./
172+
173+
- name: Test python version
174+
shell: bash
175+
run: |
176+
set -x
177+
178+
if [[ "${{ steps.test-installation.outcome }}" == "success" ]]; then
179+
echo "error: The action should have failed because both python-version and python-version-file were not given"
180+
exit 1
181+
else
182+
echo "success: The action successfully failed because both python-version and python-version-file were not given"
183+
fi

0 commit comments

Comments
 (0)