Repository navigation
refactor(DropdownMenu): the finger a trigger hands to the menu runs on the shared action-group tracker #30568
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| name: Lint | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: {} | |
| # A new push to a pull request cancels its superseded run; each push to main | |
| # keeps its own uncancelled group. | |
| concurrency: | |
| group: 'lint-${{ github.event.pull_request.number || github.run_id }}' | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| lint: | |
| runs-on: 2-core-ubuntu-arm | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Classify changed files | |
| if: github.event_name == 'pull_request' | |
| id: scope | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=50 | |
| MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }} 2>/dev/null || echo "") | |
| if [ -z "$MERGE_BASE" ]; then | |
| printf 'docsite_only=false\nspec_only=false\ntooling_only=false\n' >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| CLASSIFIER_ROOT="$RUNNER_TEMP/change-scope" | |
| CLASSIFIER_DIR="$CLASSIFIER_ROOT/.github/scripts" | |
| REGISTRY_DIR="$CLASSIFIER_ROOT/scripts" | |
| mkdir -p "$CLASSIFIER_DIR" "$REGISTRY_DIR" | |
| CLASSIFIER="$CLASSIFIER_DIR/change-scope.cjs" | |
| MATCHER="$CLASSIFIER_DIR/knowledge-paths.cjs" | |
| REGISTRY="$REGISTRY_DIR/component-packages.cjs" | |
| if git show "origin/${{ github.base_ref }}:.github/scripts/change-scope.cjs" > "$CLASSIFIER" 2>/dev/null \ | |
| && git show "origin/${{ github.base_ref }}:.github/scripts/knowledge-paths.cjs" > "$MATCHER" 2>/dev/null \ | |
| && git show "origin/${{ github.base_ref }}:scripts/component-packages.cjs" > "$REGISTRY" 2>/dev/null; then | |
| git diff --name-status "$MERGE_BASE"...HEAD \ | |
| | node "$CLASSIFIER" --github-output | |
| else | |
| # Missing trusted policy or dependencies cannot grant a specialized | |
| # lane. Run full lint until the base branch supplies the classifier. | |
| printf 'docsite_only=false\nspec_only=false\ntooling_only=false\n' \ | |
| >> "$GITHUB_OUTPUT" | |
| fi | |
| # Merge-back carries exact published release-branch outputs into main under | |
| # trusted validation (spec:AST-017 FR50). Detect its branch contract so | |
| # required lint can route it to the stronger validator. | |
| - name: Detect the release merge-back branch contract | |
| if: github.event_name == 'pull_request' | |
| id: release-merge-back-scope | |
| env: | |
| MERGE_BRANCH: ${{ github.head_ref }} | |
| run: | | |
| required=false | |
| case "$MERGE_BRANCH" in | |
| chore/merge-v*-to-main) | |
| VERSION=${MERGE_BRANCH#chore/merge-v} | |
| VERSION=${VERSION%-to-main} | |
| if printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| required=true | |
| fi | |
| ;; | |
| esac | |
| echo "required=$required" >> "$GITHUB_OUTPUT" | |
| - name: Validate release merge-back in required lint | |
| if: github.event_name == 'pull_request' && steps.release-merge-back-scope.outputs.required == 'true' | |
| env: | |
| MERGE_BRANCH: ${{ github.head_ref }} | |
| run: | | |
| set -eu | |
| VERSION=${MERGE_BRANCH#chore/merge-v} | |
| VERSION=${VERSION%-to-main} | |
| git fetch origin main 'refs/tags/v*:refs/tags/v*' '+refs/heads/release/v*:refs/remotes/origin/release/v*' | |
| TRUSTED_POLICY="$RUNNER_TEMP/release-policy" | |
| mkdir -p "$TRUSTED_POLICY/scripts/release" "$TRUSTED_POLICY/scripts/lib" | |
| git show origin/main:scripts/release/active-release.mjs \ | |
| > "$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| git show origin/main:scripts/lib/workspace-globs.mjs \ | |
| > "$TRUSTED_POLICY/scripts/lib/workspace-globs.mjs" | |
| VALIDATOR="$TRUSTED_POLICY/scripts/release/active-release.mjs" | |
| ACTIVE_BRANCHES=$(node "$VALIDATOR" list-active --root "$GITHUB_WORKSPACE") | |
| node "$VALIDATOR" validate-merge-back \ | |
| --root "$GITHUB_WORKSPACE" \ | |
| --base origin/main \ | |
| --release-ref "v$VERSION" \ | |
| --active-branches "$ACTIVE_BRANCHES" | |
| # A change that ships to consumers names its package in a Changeset, and a | |
| # released CLI JSON id cannot disappear unclassified. The release coverage | |
| # audit runs the same classifier over the cut range, so the two agree. | |
| - name: Check Changeset coverage | |
| if: github.event_name == 'pull_request' && steps.release-merge-back-scope.outputs.required != 'true' | |
| env: | |
| MERGE_SHA: ${{ github.sha }} | |
| run: | | |
| set -eu | |
| # The checked-out merge commit and its first parent (the base branch | |
| # tip): exactly what this pull request lands. | |
| git fetch --no-tags --depth=2 origin "$MERGE_SHA" | |
| RELEASED=$(git ls-remote --tags --refs origin 'v*' \ | |
| | sed 's#.*refs/tags/##' \ | |
| | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \ | |
| | sort -V | tail -n 1) | |
| if [ -z "$RELEASED" ]; then | |
| echo 'No vX.Y.Z release tag found to compare CLI JSON ids against.' | |
| exit 1 | |
| fi | |
| git fetch --no-tags --depth=1 origin "+refs/tags/${RELEASED}:refs/tags/${RELEASED}" | |
| node scripts/release/changeset-coverage.mjs pr \ | |
| --base "$MERGE_SHA^1" --head "$MERGE_SHA" --released "$RELEASED" | |
| - name: Skip full lint for lightweight docs | |
| if: steps.scope.outputs.docsite_only == 'true' || steps.scope.outputs.spec_only == 'true' | |
| run: echo "Lightweight documentation PR — skipping full lint" | |
| - uses: ./.github/actions/setup | |
| if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' | |
| - name: Clear ESLint cache | |
| if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' | |
| run: rm -rf .eslintcache node_modules/.cache | |
| - name: Check repository guardrails | |
| if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' | |
| run: pnpm check:repo | |
| # The CLI README's generated tables (commands, error codes, response | |
| # types) ship to consumers. A merge from main can silently drop a | |
| # generated row, so the merged result is checked against its sources. | |
| - name: Check generated CLI README | |
| if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' | |
| run: node packages/cli/scripts/generate-cli-readme.mjs --check | |
| # The full pass, type-aware rules over packages/core/src included, needs | |
| # about 1.9 GB of heap on main. Node's default limit on this 8 GB runner | |
| # is about 2 GB, so a pull request that adds a few percent of source can | |
| # run it out of memory. 4 GB keeps the pass under half the runner's RAM | |
| # (3.3 GB peak RSS measured) and spends less time in GC. | |
| - name: Run ESLint | |
| if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true' | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=4096' | |
| run: pnpm lint |