# GitHub Actions

Testery integrates with GitHub Actions via the [Testery CLI](/integrations/testery-cli-docs.md).

You'll need to define a GitHub Actions workflow. This is done by creating a yml file in the `.github/workflows` folder in your repository.

**Step 1. Retrieve your Testery API Token.** To retrieve your token, click **Settings → Integrations → Show API Token** and copy the token that is displayed. Keep this token secure as it allows access to Testery on your behalf.

**Step 2. Store your Testery API Token as a** [**GitHub Actions secret**](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets)**.** This is referenced in your GitHub Actions workflow as follows:

```yaml
jobs:
  build:
    ...
    env:
      TESTERY_TOKEN: ${{ secrets.TesteryTokenProd }}
    ...
```

**Step 3.** **Add steps to your GitHub Actions workflow to install the** [**Testery CLI**](/integrations/testery-cli-docs.md) **and create the test run.**

Here is a sample `.github/workflows/testery.yml`

```yaml
name: Testery Tests

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    env:
      TESTERY_TOKEN: ${{ secrets.TesteryTokenProd }}

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: "3.x"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install testery --upgrade
      - name: Deploy Application
        run: |
          ... logic to deploy your application ...
      - name: Run Testery Tests
        run: |
          # Create test run.
          testery create-test-run --api-url https://api.testery.io/api --token "$TESTERY_TOKEN" --include-tags "smoke" \
              --variable "TEST_URL=${TEST_URL}" \
              --git-ref "$GITHUB_SHA" --project "example-webdriverio" --environment "testery-dev" \
              --wait-for-results

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testery.io/integrations/ci-cd-integration-guide/github-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
