GitHub Actions is a powerful continuous integration and continuous delivery (CI/CD) platform that enables you to automate your software development workflows directly from your GitHub repository. It provides seamless integration with GitHub’s ecosystem, making it an ideal choice for teams looking to automate their API testing workflows. Bruno CLI integrates seamlessly with GitHub Actions to automate API testing workflows.Documentation Index
Fetch the complete documentation index at: https://bruno-a6972042-mintlify-testing-jsonbody-jsonschema-1777266.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
To follow along with the video, clone the Bruno Automation Demo Workspace and open it in Bruno.
Prerequisites
- Git installed.
- A GitHub repository containing a Bruno workspace.
- Node.js (for installing the Bruno CLI).
Workspace Structure
The demo workspace is organized as a Bruno workspace with an OpenCollection layout:workspace.yml— defines the workspace and points to the collection atcollections/bruno-automation-demo.environments/ci.yml— a global environment with variables likebruno_echo_url,platform_name, andbuild_idused across all collections.collections/bruno-automation-demo/— the collection itself, containing folders of requests with tests and assertions.
Create the GitHub Actions Workflow
- In your repository, create the workflow directory:
- Create
.github/workflows/bruno-api-tests.yml:
What this workflow does
| Step | Purpose |
|---|---|
| Check out repository | Clones your repo so the runner has access to the workspace and collections. |
| Set up Node.js | Installs Node.js, which is required to run the Bruno CLI. |
| Install Bruno CLI | Installs @usebruno/cli globally via npm. |
| Prepare report directory | Creates a reports/ folder for the HTML test report. |
| Run Bruno demo collection | Runs bru run from inside the collection directory (see details below). |
| Upload Bruno report | Saves the HTML report as a downloadable GitHub Actions artifact. |
Key bru run flags
--global-env ci— activates theciglobal environment defined inenvironments/ci.ymlat the workspace root.--workspace-path ../..— tells Bruno where the workspace root is relative to the collection directory. This is required when runningbru runfrom inside a collection folder.--tags smoke,workflow,release-gate— only runs requests tagged with these values.--env-var— overrides environment variables at runtime, useful for injecting CI-specific values like the GitHub run ID and commit SHA.--reporter-html— generates an HTML report of the test results.
Run the Workflow
- Commit and push your workflow file:
-
Monitor the workflow:
- Go to your GitHub repository and click the Actions tab.
- The workflow runs automatically on pushes and pull requests to
main, or you can trigger it manually with workflow_dispatch.
-
View the report:
- Once the run completes, click into the workflow run.
- Download the bruno-report artifact from the Artifacts section.
- Open
github-actions-report.htmlin your browser for a visual summary of all test results.