Skip to main content
← Back to Blog

Publish Allure Reports on GitHub Pages with GitHub Actions

By · 3 min

To publish an Allure report on GitHub Pages you need three things: a branch that holds the report, GitHub Pages pointed at that branch, and a GitHub Actions workflow with write permission that generates and pushes the report after every test run. This guide sets up all three, step by step, so your team always finds the latest report at one URL.

Why Use GitHub Pages for Allure Reports?

GitHub Pages offers a free and simple way to host your project’s documentation or, in this case, your Allure Reports. By making these reports available on GitHub Pages, you ensure that your team can easily access them anytime and anywhere, facilitating better communication and quicker decision-making based on test results. This setup is especially beneficial for automated testing, as it allows for continuous integration and delivery processes, making your development workflow more efficient and streamlined.

Step 1: Create a New Branch

First things first, you’ll need to create a new branch in your GitHub repository. This branch is typically named gh-pages. Here’s how:

    1. Go to your GitHub repository.
    1. Click on the branch selector menu at the top left.
    1. Type a name in the new branch text box(in my case allure-report).
    1. Click the “Create branch: allure-report” from the dropdown.

Step 2: Set Up GitHub Pages

Next, you’ll set up GitHub Pages to serve content from the allure-report branch.

    1. In your repository, go to “Settings” > “Pages.”
    1. Under “Source,” select the allure-report branch from the dropdown menu.
  1. Click “Save.”

GitHub Pages settings with Source “Deploy from a branch” and the allure-report branch selected (highlighted)

Step 3: Configure Workflow Permissions

For GitHub Actions to deploy your Allure Report to GitHub Pages, you need to adjust the workflow permissions to allow read and write operations.

    1. In your repository, go to “Settings” > “Actions” > “General.”
    1. Scroll down to “Workflow permissions.”
    1. Select “Read and write permissions.”
    1. Save your changes.

GitHub Actions settings with Workflow permissions set to “Read and write permissions” (highlighted)

Step 4: Add the Deploy Step in a YAML File

Finally, you need to add a deploy step in your GitHub Actions workflow to automatically generate and publish your Allure Report to the allure-report branch. You’ll do this in a YAML (.yml) file inside the .github/workflows directory in your repository. If this directory doesn’t exist, you’ll need to create it along with your YAML file.

Here’s an example of what the deploy step looks like in my yml file:

## Allure report
- name: Generate Allure Report
        run: |
          npm install -g allure-commandline
          allure generate allure-results -o allure-report --clean

   ## Deploy step
- name: Deploy Allure Report to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
            github_token: ${{ secrets.GITHUB_TOKEN }}
            publish_dir: ./allure-report
            publish_branch: allure-report
            keep_files: false

This step uploads your Allure Report as an artifact of your workflow. You will need to customize the path to where your Allure Report is generated in your project.

Following the completed run tests, a pages build and deployment job will be run to deploy the allure-report automatically to the allure-report branch. Here you can find a link (which you can share with your peers or managers) to the report.

GitHub Actions runs list with pages build and deployment runs that publish the Allure report

GitHub Actions pages-build-deployment run with build and deploy jobs and the link to the published Allure report

If you want to have see a live working example I have created a working version in my demoenvironment which you can find on github pages

The github repo you can find here in which you can find a working github actions example github repo

Conclusion

By following these steps, you can easily serve your Allure Reports on GitHub Pages, making them accessible to your team and enhancing your automated testing process. This approach not only improves the visibility of your test results but also integrates seamlessly with your existing GitHub workflow, making your development process more efficient and collaborative.

Next step

Learn this step by step in the course Get Started with Test Automation in the AI Era

Unit, API and UI tests with Playwright, written with AI and judged by breaking the code on purpose.

View the course →

Ralph van der Horst

Test automation consultant and builder of selenium-ai-agent and Robotyxx. Writes about AI, test automation and RPA from hands-on project work. More about me →

Related articles