Hi,
It would appear that the githib k6 run action does not allow environment variables to be used in the options object of a test.
Here are screenshots of minimal examples of the test.js and load-test.yaml files
Please note that there may be a syntactic mistake or 2 but hopefully the concept is still clear.
When the action is executed in github, the following error message is displayed.
Validating test run files.
time=2025-05-15T10:03:36Z level=error msg=TypeError: Cannot read property ‘threshold_http_req_failed_rate’ of undefined\n\tat file:///home/runner/actions-runner/_work/test.js:21:50(xx)\n hint=script exception
This same script works when run locally: k6 run --env TEST_DURATION=5m --env TARGET_ENVIRONMENT=integration - <test.js
And it also works when manually installing and running k6 in the github workflow file instead of using the setup and run actions.
I suspect it may have something to do with the script validation step of the github run action as there does not seem to be a validation step when running locally
Any ideas what I might be doing wrong.
Thank you in advance.
Morné
4 posts - 2 participants