Ensure that you have commonality installed as a dependency at the root of your project.

Create a workflow file for Commonality at .github/workflows/commonality.yml and add steps to run commonality check and commonality constrain.

.github/workflows/commonality.yml
name: Commonality

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  validate:
    name: Validate
    timeout-minutes: 15
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'

      - name: Install dependencies
        run: npm install

      - name: Check
        run: npm exec -- commonality check

      - name: Constrain
        run: npm exec -- commonality constrain

Was this page helpful?