Skip to content

push-based/user-flow-gh-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Chrome Lighthouse user flows as GitHub action

This repository maintains a GitHub action to run @push-based/user-flow in a workflow. It automatically detects flows, executes them and produces md reports as comments in your PR.

user-flow-gh-action-cover

Inputs:

Name Type Default Description
--commentId string user flow summary report Id used to identify a comment in the PR (useful if multiple actions run user-flow for the same PR)
--commentsOnly string off Only collects results and creates a comment in the PR (helpful if the reports are generated over external logic)
--rcPath string ./user-flowrc.json Path to .user-flowrc.json. e.g. ./user-flowrc.server.json
--verbose string off Run with verbose logging (only 'on' and 'off' is possible)
--dryRun string off Run in dryRun mode (only 'on' and 'off' is possible)
... ... ... All other actions from the user-flow CLI are available

Setup

  1. Create a file called user-flow-ci.yml in ./.github/workflows.

This can be done by using the init:
npx @push-based/user-flow init --generateGhWorkflow

  1. The generated user-flow-ci.yml file should have the following content:
name: user-flow-ci
on:
  pull_request:
jobs:
  user-flow-integrated-in-ci:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x]
    steps:
      - uses: actions/checkout@v2
      - name: Executing user-flow CLI
        # without any parameters the rcPath defaults to `.user-flowrc.json`
        uses: push-based/[email protected]

You can use action inputs over the with property:

name: user-flow-ci
on:
  pull_request:
jobs:
  user-flow-integrated-in-ci:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x]
    steps:
      - uses: actions/checkout@v2
      - name: Executing user-flow CLI
        # without any parameters the rcPath defaults to `.user-flowrc.json`
        uses: push-based/[email protected]
        with:
          commentId: test-e2e-first-run
          dryRun: off
          verbose: on
          url: https://google.com
          ufPath: ./user-flows
          outPath: ./packages/user-flow-gh-action-e2e/measures
          format: html,json
          rcPath: ./.user-flowrc.json

How to test the setup

  1. If you open a new PR in your repository you should see the runner execution your user-flow in the CI

gh-ci-running

gh-ci-complete

  1. After the user flow executed you should see a mark down report as comment attached to your PR

gh-ci-comment

How to use it with the nx-plugin and --affected

If you use Nx as you tooling choice you should consider our Nx plugin for user-flow.

Here is how you can combine it with the GitHub action:

  1. Use the action with commentsOnly. besides the outPath no other params are considered.
  name: user-flow-ci
  on:
    pull_request:
  jobs:
    user-flow-integrated-in-ci:
      runs-on: ubuntu-latest
      strategy:
        matrix:
          node-version: [18.x]
      steps:
        - uses: actions/checkout@v2
        - name: Executing user-flow CLI
          uses: push-based/[email protected]
          with:
            verbose: on
            commentId: test-e2e-first-run
            commentsOnly: on

made with ❤ by push-based.io