Skip to content
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

Code PushUp GitHub Action

GitHub Super-LinterCICheck dist/CodeQLCoverage

🤖 GitHub Action for integrating Code PushUp into your CI workflows.

showcase

Features

  • 📃 Collects a Code PushUp report on push to remote branch.
  • 📉 Uploads reports to workflow artifacts and/or Code PushUp portal (optional).
  • 💬 When a PR is opened/updated, compares reports for source and target branches, and creates/updates a PR comment which summarizes the impact of the changes.
    • ⚠️ Also annotates changed files with new issues encountered by Code PushUp.
  • 🏢 Supports monorepo setups - runs per project and summarizes comparisons in a single PR comment.

Workflow example

name: Code PushUpon:
push:
branches: [main]pull_request:
branches: [main]permissions:
contents: readactions: readpull-requests: writejobs:
code-pushup:
runs-on: ubuntu-lateststeps:
- name: Clone repositoryuses: actions/checkout@v4
- name: Set up Node.jsuses: actions/setup-node@v4
- name: Install dependenciesrun: npm ci
- name: Code PushUpuses: code-pushup/github-action@v0

Action inputs

The action may be customized using the following optional inputs:

NameDescriptionDefault
monorepoEnables monorepo modefalse
parallelConfigured parallel execution in monorepo modefalse
projectsCustom projects configuration for monorepo modenone
taskName of command to run Code PushUp per project in monorepo modecode-pushup
nxProjectsFilterCLI arguments used to filter Nx projects in monorepo mode--with-target={task}
configPatternsPerformance optimization for large monorepos, see @code-pushup/ci docsnone
tokenGitHub token for authorizing GitHub API requests${{ github.token }}
annotationsToggles if annotations should be created for relevant Code PushUp issuestrue
artifactsToggles if artifacts will we uploaded/downloadedtrue
skipCommentToggles if comparison comment is posted to PRfalse
searchCommitsExtends previous report caching for portal users, see @code-pushup/ci docsfalse
retentionArtifact retention period in daysfrom repository settings
directoryDirectory in which code-pushup should runprocess.cwd()
configPath to config file (--config option)see @code-pushup/cli docs
silentToggles if logs from Code PushUp CLI are printedfalse
binCommand for executing Code PushUp CLInpx --no-install code-pushup
jobIdDifferentiate PR comments (useful if multiple jobs run Code PushUp)none

For example, this will run code-pushup commands in a non-root folder and retain report artifacts for 30 days:

- uses: code-pushup/github-action@v0with:
directory: websiteretention: 30

Action outputs

Some outputs are set in case you want to add further steps to your workflow.

NameDescription
artifact-idID of uploaded report artifact (N/A in monorepo mode)
comment-idID of created/updated PR comment

Example of using step outputs:

- uses: code-pushup/github-action@v0id: code-pushup
- run: | echo "Comment ID is ${{ steps.code-pushup.outputs.comment-id }}" echo "Artifact ID is ${{ steps.code-pushup.outputs.artifact-id }}"

Authentication

The GitHub Action supports multiple authentication methods to integrate with your CI workflows.

GitHub App authentication (recommended)

For the most seamless authentication experience, we recommend installing the Code PushUp GitHub App.

The action automatically detects the GitHub App installation and uses it for enhanced API access. This provides better security through short-lived tokens and requires zero configuration on your part.

Default authentication

If the GitHub App is not installed, the action automatically uses the default GITHUB_TOKEN provided by GitHub Actions, which works perfectly for most use cases.

Custom authentication

You can provide your own token if you have specific requirements:

- uses: code-pushup/github-action@v0with:
token: ${{ secrets.YOUR_PAT }}

Monorepo mode

By default, the GitHub Action assumes your repository is a standalone project. But it also supports monorepo setups where reports are collected and compared individually per project. All project comparisons are then combined into a single PR comment.

Use the monorepo input to active monorepo mode:

- uses: code-pushup/github-action@v0with:
monorepo: true

The GitHub Action will try to detect which monorepo tool you're using from the file system. The following tools are supported out of the box:

If you're using one of these tools, you can also skip auto-detection by setting monorepo input to nx, turbo, yarn, pnpm or npm.

If none of these tools are detected, then the fallback is to run Code PushUp in all folders which have a package.json file. If that's not what you want, then you can also configure folder patterns using the optional projects input (comma-separated globs):

- uses: code-pushup/github-action@v0with:
monorepo: trueprojects: 'frontend, backend/*'

Based on which monorepo tool is used, Code PushUp CLI commands will be executed using a package.json script, Nx target, Turbo task, or binary executable (as fallback). By default, these are expected to be called code-pushup, but you can override the name using the optional task input:

- uses: code-pushup/github-action@v0with:
monorepo: nxtask: analyze # custom Nx target

In Nx monorepos, projects are listed using nx show projects --with-target=code-pushup by default. The nxProjectsFilter input sets the CLI arguments forwarded to nx show projects (default is --with-target={task}, with {task} being replaced by the task input value). This gives a lot of flexibility in customizing which Nx projects should be run:

- uses: code-pushup/github-action@v0with:
monorepo: nxnxProjectsFilter:
'--with-target=code-pushup --affected --projects=apps/* exclude=*-e2e'

Parallel tasks

By default, tasks are run sequentially for each project in the monorepo. The parallel input enables parallel execution for tools which support it (Nx, Turborepo, PNPM, Yarn 2+).

- uses: code-pushup/github-action@v0with:
monorepo: trueparallel: true

The maximum number of concurrent tasks can be set by passing in a number instead of a boolean:

- uses: code-pushup/github-action@v0with:
monorepo: trueparallel: 3

About

GitHub Action for automating feedback from Code PushUp

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages