# Github Actions

# Pre-requisites

  1. Ensure Docker is installed on the GitHub Actions runner.
  2. Setup your repository with the required permissions to access the GitHub Actions environment.

# Setup Instructions

# 1. Create or open an existing GitHub Actions workflow.

# 2. Insert this snippet to run tests using KushoAI:

name: Run KushoAI Tests

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  run-kusho-tests:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Docker
        uses: docker/setup-buildx-action@v1

      - name: Pull KushoAI Docker Image
        run: docker pull public.ecr.aws/y5g4u6y7/kusho-jenkins-runner:latest

      - name: Run KushoAI Test Suite
        env:
          TEST_SUITE_UUID: "<TEST_SUITE_UUIDS>"
          ENVIRONMENT_ID: "<ENV_ID>"
          API_KEY: ${{ ERROR }}
          EMAIL: "<COMMA_SEPARATED_EMAILS>"
        run: |
          docker run --rm \
            -e TEST_SUITE_UUID="${{ ERROR }}" \
            -e ENVIRONMENT_ID="${{ ERROR }}" \
            -e API_KEY="${{ ERROR }}" \
            -e EMAIL="${{ ERROR }}" \
            public.ecr.aws/y5g4u6y7/kusho-jenkins-runner:latest

# 3. Add your API Key to the snippet:

Navigate to your GitHub repository's Settings -> Secrets -> Actions. Add a new secret named KUSHOAI_API_KEY with your KushoAI API key.

# 4. Add your Test Suite UUIDs to the snippet:

Navigate to Test Suites. Copy the UUIDs of the test suites you want to run, and replace <TEST_SUITE_UUIDS> in the workflow snippet. You can paste multiple comma-separated UUIDs to run multiple test suites.

# 5. Add comma-separated emails to receive the test report:

Update the EMAIL variable in the script to include the email addresses where you want the report sent. For multiple emails, add them in a comma-separated format, e.g., "email1@example.com,email2@example.com". This step is optional. If you don't provide an email, the report won't be sent via email.