Skip to content

Commit 406df06

Browse files
committed
test: LLM_API_KEY existance.
1 parent b91870c commit 406df06

2 files changed

Lines changed: 31 additions & 8 deletions

File tree

.github/workflows/test-action.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
- name: Checkout repository
2121
uses: actions/checkout@v3
2222

23-
- name: Test OpenHands AI Action
24-
id: openhands
23+
- name: Test OpenHands AI Action with valid API key
24+
id: openhands_valid
2525
uses: ./
2626
with:
2727
prompt: "What is 2+2?"
@@ -32,19 +32,34 @@ jobs:
3232
"TEST_VAR": "test_value"
3333
}
3434
35-
- name: Verify outputs
35+
- name: Verify outputs with valid API key
3636
run: |
37-
echo "Task ID: ${{ steps.openhands.outputs.task_id }}"
38-
echo "Status: ${{ steps.openhands.outputs.status }}"
39-
echo "Result: ${{ steps.openhands.outputs.result }}"
37+
echo "Task ID: ${{ steps.openhands_valid.outputs.task_id }}"
38+
echo "Status: ${{ steps.openhands_valid.outputs.status }}"
39+
echo "Result: ${{ steps.openhands_valid.outputs.result }}"
4040
4141
# Basic validation of outputs
42-
if [ -z "${{ steps.openhands.outputs.task_id }}" ]; then
42+
if [ -z "${{ steps.openhands_valid.outputs.task_id }}" ]; then
4343
echo "Error: Task ID is empty"
4444
exit 1
4545
fi
4646
47-
if [ -z "${{ steps.openhands.outputs.status }}" ]; then
47+
if [ -z "${{ steps.openhands_valid.outputs.status }}" ]; then
4848
echo "Error: Status is empty"
4949
exit 1
50+
fi
51+
52+
- name: Test OpenHands AI Action without API key
53+
id: openhands_invalid
54+
continue-on-error: true
55+
uses: ./
56+
with:
57+
prompt: "What is 2+2?"
58+
log_all_events: "true"
59+
60+
- name: Verify error without API key
61+
run: |
62+
if [ "${{ steps.openhands_invalid.outcome }}" != "failure" ]; then
63+
echo "Error: Action should have failed without API key"
64+
exit 1
5065
fi

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ runs:
5757
- name: Set up Docker
5858
uses: docker/setup-buildx-action@v2
5959

60+
- name: Validate LLM API Key
61+
shell: bash
62+
run: |
63+
if [ -z "${{ inputs.llm_api_key }}" ]; then
64+
echo "::error::LLM_API_KEY is required but not provided"
65+
exit 1
66+
fi
67+
6068
- name: Run OpenHands
6169
id: openhands
6270
shell: bash

0 commit comments

Comments
 (0)