Github Actions
Integrate Low Code Automation API with GitHub Actions to trigger test suite execution and monitor build statuses in your CI/CD workflow.
Integrate the provided script into your GitHub Actions workflow file within a step, ensure to replace placeholders with actual BrowserStack credentials.
Copy
name: Test and Deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger Test Suite
id: trigger_test_suite
run: |
response=$(curl -u YOUR_USERNAME:YOUR_ACCESS_KEY -X POST https://lcnc-api.browserstack.com/api/v1/test-suite/${TEST_SUITE_ID}/run)
BUILD_ID=$(echo $response | jq -r '.build_id')
echo "::set-output name=build_id::$BUILD_ID"
echo "Build ID: $BUILD_ID"
- name: Check Build Status
run: |
buildStatus=""
retryInterval=30
BUILD_ID=$
while [[ ("$buildStatus" != "passed" && "$buildStatus" != "failed") ]]; do
response=$(curl -u YOUR_USERNAME:YOUR_ACCESS_KEY -s https://lcnc-api.browserstack.com/api/v1/builds/$BUILD_ID/status)
buildStatus=$(echo $response | jq -r '.build_status')
sleep $retryInterval
done
if [[ "$buildStatus" == "passed" ]]; then
echo "Build passed"
# Add further steps for actions to be taken if build passed
elif [[ "$buildStatus" == "failed" ]]; then
echo "Build failed"
exit 1
else
echo "Build status unstable"
exit 1
fi
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!