Level CI integrates into your GitHub workflow through a custom GitHub Action that collects accessibility reports generated during E2E tests and triggers analysis.
On this page:
- Prerequisites:
- Add repository secrets
- Install the Level CI CLI
- Create the configuration file
- Update the GitHub Actions workflow
- Verify the configuration
Prerequisites:
Access to your GitHub repository
- A Level CI project token
- A Cloudsmith token
- Existing E2E tests configured in your project
Add repository secrets
You must add the required secrets to your GitHub repository before configuring Level CI.
To add repository secrets:
- In your GitHub repository, go to Settings.
- Select Secrets and variables.
- Click Actions.
- Select New repository secret.
-
Add the Cloudsmith token.
Field Value Name
CLOUDSMITH_TOKENSecret
Paste the Cloudsmith token value
-
-
Select Add secret. Add the Level CI project token:
Field Value Name LEVEL_CI_TOKENSecret Paste the Level CI project token value - Select Add secret.
Install the Level CI CLI
Install the @level-ci/cli package in the root directory of your project.
npm install --save-dev @level-ci/cli
The Level CI CLI provides:
- A command-line interface for accessibility scans
- TypeScript types for configuration files
Create the configuration file
Create a level-ci.config.ts file in the root directory of your project.
If you prefer JavaScript, you can create a .js file instead.
import type { Config } from '@level-ci/cli'
export default {
organization: 'your_organisation',
project: 'your_project',
token: process.env.LEVEL_CI_TOKEN,
reportPaths: ['./level-ci-reports'],
} satisfies ConfigUpdate the GitHub Actions workflow
Update your .github/workflows/build.yml file and add the Level CI step after your E2E test execution steps.
# .github/workflows/build.yml
- name: Install npm packages
run: npm ci
env:
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
# Insert your e2e test execution steps here
- name: Level CI Accessibility Analysis
uses: levelaccess/level-ci@main
env:
LEVEL_CI_TOKEN: ${{ secrets.LEVEL_CI_TOKEN }}Verify the configuration
Before committing your changes, verify that the configuration works locally.
To verify the configuration:
- Make sure your E2E tests pass locally.
-
Run the following command in your terminal:
npx level-ci --verify --token=<your_project_token>
Next steps
After completing the configuration:
- Run your GitHub Actions workflow
- Review generated accessibility reports
- Confirm that Level CI analysis results appear in your project