Skip to content

[ENG-2185] Adding Consent #18633

[ENG-2185] Adding Consent

[ENG-2185] Adding Consent #18633

name: Frontend Code Checks
on:
pull_request:
merge_group:
types: [checks_requested]
push:
branches:
- "main"
- "release-**"
env:
CI: true
jobs:
Check-Frontend-Changes:
runs-on: ubuntu-latest
outputs:
has_frontend_changes: ${{ steps.filter.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for frontend file changes
uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
frontend:
- 'clients/**'
- '.github/workflows/frontend_checks.yml'
- name: Log changed files
if: steps.filter.outputs.frontend == 'true'
run: echo "${{ steps.filter.outputs.frontend_files }}"
Clients-Unit:
needs: Check-Frontend-Changes
if: needs.Check-Frontend-Changes.outputs.has_frontend_changes == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
clients:
- "admin-ui"
- "privacy-center"
- "fides-js"
defaults:
run:
working-directory: clients
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Generate docs
if: matrix.clients == 'fides-js'
working-directory: clients/fides-js
run: npm run docs:generate
- name: Fail if docs are not up to date
if: matrix.clients == 'fides-js'
working-directory: clients/fides-js
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "Docs are not up to date. Please run 'npm run docs:generate' and commit the changes.";
git status
git diff
exit 1
fi
- name: Lint
run: npm run lint
- name: Format
run: npm run format:ci
- name: Build FidesJS # needed for type checks
working-directory: clients/fides-js
run: npm run build
- name: Unit test (${{ matrix.clients }})
working-directory: clients/${{ matrix.clients }}
run: npm run test:ci
# Summary job for branch protection - consolidates all frontend checks
Frontend-Checks-Summary:
runs-on: ubuntu-latest
if: always()
needs:
- Clients-Unit
steps:
- name: Check job results
run: |
echo "Clients-Unit: ${{ needs.Clients-Unit.result }}"
# Fail only if jobs failed (not if skipped)
if [ "${{ needs.Clients-Unit.result }}" == "failure" ]; then
echo "❌ One or more required jobs failed"
exit 1
fi
# Check for cancelled jobs (treat as failure)
if [ "${{ needs.Clients-Unit.result }}" == "cancelled" ]; then
echo "❌ One or more required jobs were cancelled"
exit 1
fi
echo "✅ All required frontend checks passed or were skipped"