GitHub Actions
The least-privilege workflow motionpr init --github writes, and what each step does.
On this page
npx motionpr init --githubwrites .github/workflows/motionpr.yml. This is the file it generated for an npm project:
# MotionPR: animation regression checks.
# See https://github.com/erenthedeveloper0/motion-pr/blob/main/docs/ci/github-actions.md
# Third-party actions are pinned to full commit SHAs; Dependabot can keep them updated.
name: MotionPR
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
motion:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
- run: npm ci
- name: Install Chromium for MotionPR
run: npx motionpr install --with-deps
- name: Run MotionPR
run: npx motionpr run --ci
- name: Upload MotionPR report
if: ${{ always() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: motionpr-report
path: .motionpr/report
if-no-files-found: ignore
retention-days: 14With pnpm it adds pnpm/action-setup and runs pnpm install --frozen-lockfile and
pnpm exec motionpr; with yarn, yarn install --frozen-lockfile and yarn motionpr. The
workflow uses Node.js 24; change node-version if your project needs another.
What each step does
| Step | Notes |
|---|---|
motionpr install --with-deps | Chromium plus its system libraries on the Ubuntu runner (about a minute) |
motionpr run --ci | Captures, compares with the committed .motionpr/baseline, writes the report, appends the summary to $GITHUB_STEP_SUMMARY, exits 0, 1 or 2 |
| Upload report | Runs even when the previous step failed (always()), so a regression always comes with its report |
The summary on the run page is the Markdown shown in
motionpr compare. The job fails on exit 1 (a difference
reached comparison.failOn) and 2 (an error, or no baseline yet; pass
--allow-missing-baseline while bootstrapping).
Next
- Pull request workflow: two ways to set up the comparison.
- Baseline management: approving changes, capturing on Linux.
- Report artifacts: downloading and opening reports.
- Security: why
contents: readandpull_requestare enough.