Skip to content

deps: bump the minor-and-patch group across 2 directories with 4 upda… #857

deps: bump the minor-and-patch group across 2 directories with 4 upda…

deps: bump the minor-and-patch group across 2 directories with 4 upda… #857

Workflow file for this run

name: Test JS Frameworks
on:
push:
branches: [main]
# No paths filter on pull_request — required status checks need this workflow to
# always trigger so the aggregator can report. find-projects below narrows the
# matrix to only projects whose subtree changed, so docs-only / other-framework
# PRs produce an empty matrix → test job skipped → aggregator passes via
# `result == 'skipped'`.
pull_request:
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:
permissions:
contents: read
# Needed by find-projects' `gh api .../pulls/N/files` call.
pull-requests: read
jobs:
find-projects:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.find.outputs.matrix }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
# Default shallow checkout — we only need the working tree for `find`
# below, not git history. The PR's changed files come from gh api.
- id: find
env:
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
WORKFLOW_FILE: .github/workflows/test-js.yml
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
# Exclude `.angular/cache/**/package.json` — Angular's Vite dep cache
# writes nested package.json files inside .angular/cache after a build.
# On a fresh CI checkout the cache doesn't exist yet, but the exclude
# hardens us against any future ordering change that runs a build first.
ALL=$(find samples -name "package.json" -not -path "*/node_modules/*" -not -path "*/.angular/*" -exec dirname {} \; 2>/dev/null | sort)
if [ "$EVENT_NAME" = "pull_request" ]; then
CHANGED=$(gh api --paginate "/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' 2>/dev/null || echo "")
# If the workflow file itself changed, run the full matrix so we
# exercise the workflow against every sample.
if printf '%s\n' "$CHANGED" | grep -qFx "$WORKFLOW_FILE"; then
FILTERED="$ALL"
else
FILTERED=$(while IFS= read -r proj; do
[ -z "$proj" ] && continue
if printf '%s\n' "$CHANGED" | grep -q "^${proj}/"; then
echo "$proj"
fi
done <<< "$ALL")
fi
else
FILTERED="$ALL"
fi
MATRIX=$(printf '%s\n' "$FILTERED" | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
test:
needs: find-projects
if: ${{ needs.find-projects.outputs.matrix != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: ${{ fromJson(needs.find-projects.outputs.matrix) }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: "22"
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
working-directory: ${{ matrix.project }}
run: yarn install --immutable
- name: Check formatting
working-directory: ${{ matrix.project }}
run: |
if node -e "process.exit(require('./package.json').scripts?.['format:check'] ? 0 : 1)"; then
yarn format:check
fi
- name: Build
working-directory: ${{ matrix.project }}
run: |
if node -e "process.exit(require('./package.json').scripts?.['build:ci'] ? 0 : 1)"; then
yarn build:ci
else
yarn build
fi
- name: Test
working-directory: ${{ matrix.project }}
run: |
if node -e "process.exit(require('./package.json').scripts?.['test:ci'] ? 0 : 1)"; then
yarn test:ci
elif node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then
yarn test
fi
# Stable aggregator for branch protection.
all-tests-passed:
name: JS tests passed
needs: test
if: always()
runs-on: ubuntu-latest
steps:
- name: Verify test matrix succeeded
if: needs.test.result != 'success' && needs.test.result != 'skipped'
run: exit 1