Skip to content

chore(sandbox): remove the unused changelog generator #57635

chore(sandbox): remove the unused changelog generator

chore(sandbox): remove the unused changelog generator #57635

Workflow file for this run

# Copyright (c) Meta Platforms, Inc. and affiliates.
name: Lint
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
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:
if: (github.event_name != 'pull_request' || !github.event.pull_request.draft)
runs-on: ubuntu-24.04-arm
permissions:
contents: read
# The public text check reads the current title and description.
pull-requests: read
steps:
- name: Require a branch in this repository or the ci:run label
if: ${{ github.event_name == 'pull_request' && !(github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'ci:run')) }}
run: |
echo "::error::Waiting for a maintainer's ci:run label: an outside contributor's pull request runs CI once a maintainer adds it (spec:AST-030 FR17)."
exit 1
# Enough history for the merge commit to reach its merge base with the
# base branch, as ci.yml's check-scope checks out. At depth 1 the merge
# base is never found, and every pull request ran full lint.
- uses: actions/checkout@v7
with:
fetch-depth: 50
- 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
# Public text carries no internal identifier, host or name: each of the
# pull request's own commit messages and added lines, and the title
# and description as they read when the check runs, so a re-run reads an
# edit (spec:AST-030 FR27). The base branch's copy of the check runs, so
# a pull request cannot change its own check.
- name: Check public text
if: github.event_name == 'pull_request'
env:
BASE_REF: ${{ github.base_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ github.token }}
run: |
set -u
CHECK_DIR="$RUNNER_TEMP/public-text"
mkdir -p "$CHECK_DIR/.github/scripts" "$CHECK_DIR/scripts/lib"
if ! git show "origin/$BASE_REF:.github/scripts/check-public-text.mjs" > "$CHECK_DIR/.github/scripts/check-public-text.mjs" 2>/dev/null; then
echo "::notice::The base branch has no public text check yet. It runs once the check is on the base branch."
exit 0
fi
# Without the shared diff reader or the digests, the check fails.
git show "origin/$BASE_REF:scripts/lib/review-diff.mjs" > "$CHECK_DIR/scripts/lib/review-diff.mjs" 2>/dev/null \
|| rm -f "$CHECK_DIR/scripts/lib/review-diff.mjs"
git show "origin/$BASE_REF:.github/public-text-hashes.json" > "$CHECK_DIR/public-text-hashes.json" 2>/dev/null \
|| rm -f "$CHECK_DIR/public-text-hashes.json"
if ! gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" > "$CHECK_DIR/pull-request.json" 2>/dev/null; then
echo "::notice::The current title and description could not be read, so the check reads them as of this run's event."
cp "$GITHUB_EVENT_PATH" "$CHECK_DIR/pull-request.json"
fi
HEAD_SHA=$(git rev-parse HEAD^2)
BASE_TIP=$(git rev-parse HEAD^1)
MERGE_SHA=$(git rev-parse HEAD)
# The pull request's own commits come from GitHub's list of them, and
# its added lines from the base tip to this merge, so a shallow clone
# cannot read the base branch's commits as the pull request's. The
# list is used only when it holds every commit the pull request
# reports (GitHub lists at most 250).
COMMITS="$CHECK_DIR/commits.jsonl"
EXPECTED=$(node -e 'const p = require(process.argv[1]); process.stdout.write(String(p.commits ?? p.pull_request?.commits ?? ""))' "$CHECK_DIR/pull-request.json" 2>/dev/null || true)
LISTED=false
if [ -n "$EXPECTED" ] \
&& gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/commits?per_page=100" \
--jq '.[] | {sha: .sha, message: .commit.message}' > "$COMMITS" 2>/dev/null \
&& [ "$(grep -c . "$COMMITS")" -eq "$EXPECTED" ]; then
LISTED=true
fi
MERGE_BASE=$(git merge-base "$BASE_TIP" "$HEAD_SHA" 2>/dev/null || true)
# Without the list: a branch far behind its base deepens only the
# base branch and the pull request head, then, rarely, takes the
# whole history.
if [ -z "$MERGE_BASE" ] && [ "$LISTED" != true ]; then
git fetch --no-tags --deepen=500 origin "$BASE_REF" "refs/pull/$PR_NUMBER/head" > /dev/null 2>&1 || true
MERGE_BASE=$(git merge-base "$BASE_TIP" "$HEAD_SHA" 2>/dev/null || true)
fi
if [ -z "$MERGE_BASE" ] && [ "$LISTED" != true ]; then
git fetch --no-tags --unshallow origin "$BASE_REF" "refs/pull/$PR_NUMBER/head" > /dev/null 2>&1 || true
MERGE_BASE=$(git merge-base "$BASE_TIP" "$HEAD_SHA" 2>/dev/null || true)
fi
if [ -z "$MERGE_BASE" ] && [ "$LISTED" != true ]; then
echo "::error title=Public text check::Neither the pull request's commit list nor its merge base could be read, so the commits cannot be checked."
exit 1
fi
ARGS=(--base "${MERGE_BASE:-$BASE_TIP}" --head "$HEAD_SHA")
if [ "$LISTED" = true ]; then
ARGS+=(--commits-json "$COMMITS" --diff-base "$BASE_TIP" --diff-head "$MERGE_SHA")
fi
node "$CHECK_DIR/.github/scripts/check-public-text.mjs" \
"${ARGS[@]}" \
--hashes "$CHECK_DIR/public-text-hashes.json" \
--pr-json "$CHECK_DIR/pull-request.json"
# A change to a workflow, a composite action or this config runs
# actionlint over the workflows, with shellcheck on their run: scripts,
# so a broken expression, an unknown runner label or a script that cannot
# work fails here instead of on every later run. actionlint checks a
# local action's metadata and inputs where a workflow uses it, not the
# action's own steps; ci-run-scripts-parse.test.mjs parses those.
# Any other pull request skips it in a second. The binary is pinned by
# version and checksum; shellcheck reports errors only, so its existing
# warnings never block (spec:AST-030 FR11).
- name: Lint changed workflows (actionlint)
if: github.event_name == 'pull_request'
env:
ACTIONLINT_VERSION: 1.7.12
ACTIONLINT_SHA256: 325e971b6ba9bfa504672e29be93c24981eeb1c07576d730e9f7c8805afff0c6
BASE_REF: ${{ github.base_ref }}
run: |
MERGE_BASE=$(git merge-base HEAD "origin/$BASE_REF" 2>/dev/null || echo "")
if [ -n "$MERGE_BASE" ] && git diff --quiet "$MERGE_BASE"...HEAD -- .github/workflows .github/actions .github/actionlint.yaml; then
echo "No workflow or composite action changed; actionlint skipped."
exit 0
fi
if ! command -v shellcheck >/dev/null; then
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends shellcheck >/dev/null
fi
command -v shellcheck >/dev/null || { echo "::error::shellcheck is not installed."; exit 1; }
archive="$RUNNER_TEMP/actionlint.tar.gz"
# A release download can fail for a moment (a 504, say); retry it
# rather than fail the job.
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 --max-time 60 -o "$archive" \
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_arm64.tar.gz"
echo "$ACTIONLINT_SHA256 $archive" | sha256sum -c -
tar -xzf "$archive" -C "$RUNNER_TEMP" actionlint
if ! SHELLCHECK_OPTS=--severity=error "$RUNNER_TEMP/actionlint" -color -shellcheck=shellcheck -pyflakes=; then
echo "::error title=actionlint::A workflow or composite action has the problems listed above. To check locally, install actionlint (https://github.com/rhysd/actionlint/blob/main/docs/install.md) and shellcheck, then run SHELLCHECK_OPTS=--severity=error actionlint from the repository root."
exit 1
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/release/release-paths.mjs \
> "$TRUSTED_POLICY/scripts/release/release-paths.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")
# The merge commit's first parent: the main commit it was built on.
# A main that moved since would read its new files as deletions.
node "$VALIDATOR" validate-merge-back \
--root "$GITHUB_WORKSPACE" \
--base HEAD^1 \
--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"
# The docs lane installs too: it lints the docsite files that it changes.
- uses: ./.github/actions/setup
id: setup
if: 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
# A static import from an entry into a surface revealed by interaction
# or into an opt-in capability fails, unless the import-boundaries
# record lists it. A pull request also prints each entry's eager size
# at its base branch.
- name: Check component import boundaries
if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true'
env:
BASE_REF: ${{ github.base_ref }}
run: |
if [ -n "$BASE_REF" ]; then
pnpm -s check:component-import-boundaries --base-ref "origin/$BASE_REF"
else
pnpm -s check:component-import-boundaries
fi
# The probe theme is generated from the component docs, so the visual
# gate probes every documented theming target and state. A target or
# state added without regenerating is one the gate never sees.
- name: Check that the probe theme is current
if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true'
run: |
if ! pnpm -s visual:probe-theme:check; then
echo '::error title=Probe theme out of date::The probe theme or its config is out of date. Run pnpm visual:probe-theme and commit the files it changes in packages/themes/probe/src/.'
exit 1
fi
# 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 comment-provenance rule allows only the sites its baseline lists.
# A change that removes a cited site must also drop its entry, so the
# baseline never allows a site that no longer exists. A pull request
# runs the check when it changes a file the baseline lists, the
# baseline, the rule or its tooling, the ESLint config, or an ignore
# file; every push to main runs it. The check parses
# Core with the type-aware config, so it gets the same heap as ESLint.
- name: Check the comment-provenance baseline
if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true'
env:
EVENT_NAME: ${{ github.event_name }}
MERGE_SHA: ${{ github.sha }}
NODE_OPTIONS: '--max-old-space-size=6144 --import=${{ github.workspace }}/.github/scripts/lint-heap-peak.mjs'
LINT_HEAP_PEAK_FILE: ${{ runner.temp }}/lint-heap-peaks.jsonl
run: |
set -eu
# Skip only on the helper's explicit answer: an empty list, an
# error or a crash runs the check. Both paths of a rename count.
if [ "$EVENT_NAME" = pull_request ] &&
git diff --name-only --no-renames "$MERGE_SHA^1" "$MERGE_SHA" > "$RUNNER_TEMP/changed-files" &&
node .github/scripts/provenance-baseline-scope.mjs "$RUNNER_TEMP/changed-files"; then
echo 'This change touches no file the comment-provenance baseline lists, the baseline, the rule, the ESLint config or an ignore file.'
exit 0
fi
node internal/eslint-plugin-astryx/no-comment-provenance.baseline.mjs --check
# The pre-commit hook formats staged files with Prettier, but a commit
# made without it can land unformatted source. A later local merge of
# main then reformats that file inside the merging pull request, which
# fails Changeset coverage there for a change it never meant to make.
# Check the files this pull request changes, with the Prettier and the
# file patterns the hook uses. The docs lane skips it with the rest of
# full lint. The spec lane runs it: an unformatted record that lands
# turns every later pull request that touches it red. That lane installs
# no dependencies, so it installs Prettier alone, at the version the
# lockfile pins.
- name: Check formatting of changed files
if: github.event_name == 'pull_request' && steps.scope.outputs.docsite_only != 'true'
env:
MERGE_SHA: ${{ github.sha }}
run: |
set -eu
git diff --name-only --diff-filter=ACMR -z "$MERGE_SHA^1" "$MERGE_SHA" -- '*.ts' '*.tsx' '*.md' \
> "$RUNNER_TEMP/changed-files"
if [ ! -s "$RUNNER_TEMP/changed-files" ]; then
echo 'No changed TypeScript or Markdown files.'
exit 0
fi
prettier=./node_modules/.bin/prettier
if [ ! -x "$prettier" ]; then
version=$(awk '/^importers:/ {i = 1} i && /^ \.:$/ {r = 1; next} r && /^ [^ ]/ {exit} r && /^ prettier:$/ {p = 1; next} p && /version:/ {print $2; exit}' pnpm-lock.yaml | sed 's/(.*//')
if [ -z "$version" ]; then
echo '::error title=Prettier version::pnpm-lock.yaml pins no Prettier version for the root package.'
exit 1
fi
npm install --no-save --no-package-lock --ignore-scripts --loglevel=error \
--prefix "$RUNNER_TEMP/prettier" "prettier@$version" || {
echo "::error title=Prettier install::Prettier $version could not be installed; npm's error is above."
exit 1
}
prettier="$RUNNER_TEMP/prettier/node_modules/.bin/prettier"
fi
status=0
xargs -0 -r "$prettier" --list-different --ignore-unknown \
< "$RUNNER_TEMP/changed-files" > "$RUNNER_TEMP/unformatted" || status=$?
if [ -s "$RUNNER_TEMP/unformatted" ]; then
# Quote each path so the printed command pastes into a shell even
# for a path with parentheses, such as a Next.js route group.
fix="pnpm exec prettier --write $(sed "s/'/'\\\\''/g; s/.*/'&'/" "$RUNNER_TEMP/unformatted" | tr '\n' ' ')"
echo 'These changed files are not formatted with the repository'"'"'s Prettier settings:'
sed 's/^/ /' "$RUNNER_TEMP/unformatted"
echo 'Format them, commit, and push again:'
echo " $fix"
echo "::error title=Unformatted files::Run: $fix"
exit 1
fi
if [ "$status" -ne 0 ]; then
echo "::error title=Prettier failed::Prettier failed (xargs exited with $status); see the error above."
exit "$status"
fi
echo 'Every changed file is formatted.'
# The full pass, type-aware rules over packages/core/src included, ran
# out of a 4 GB heap on main after a cache wipe (about 3.9 GB in use when
# it stopped). 6 GB leaves room on this 16 GB runner and spends less time
# in GC. It bounds memory only and loosens no rule.
- name: Run ESLint
if: steps.scope.outputs.docsite_only != 'true' && steps.scope.outputs.spec_only != 'true'
env:
NODE_OPTIONS: '--max-old-space-size=6144 --import=${{ github.workspace }}/.github/scripts/lint-heap-peak.mjs'
LINT_HEAP_PEAK_FILE: ${{ runner.temp }}/lint-heap-peaks.jsonl
run: pnpm lint
# The root ESLint config lints the docsite, and the docsite has no lint
# step of its own. The docs lane skips the full pass, so it lints the
# docsite files that the pull request adds, changes or renames. It uses
# the same config, strict tier and heap as the full pass. A file that the
# config ignores stays ignored, as in the full pass.
- name: Run ESLint on changed docsite files
if: steps.scope.outputs.docsite_only == 'true'
env:
MERGE_SHA: ${{ github.sha }}
NODE_OPTIONS: '--max-old-space-size=6144 --import=${{ github.workspace }}/.github/scripts/lint-heap-peak.mjs'
LINT_HEAP_PEAK_FILE: ${{ runner.temp }}/lint-heap-peaks.jsonl
run: |
set -eu
git diff --name-only --diff-filter=ACMR -z "$MERGE_SHA^1" "$MERGE_SHA" -- \
'apps/docsite/*.ts' 'apps/docsite/*.tsx' 'apps/docsite/*.mts' 'apps/docsite/*.cts' \
'apps/docsite/*.js' 'apps/docsite/*.jsx' 'apps/docsite/*.mjs' 'apps/docsite/*.cjs' \
> "$RUNNER_TEMP/changed-docsite-files"
if [ ! -s "$RUNNER_TEMP/changed-docsite-files" ]; then
echo 'No changed docsite file that ESLint lints.'
exit 0
fi
xargs -0 -r pnpm exec eslint --max-warnings=-1 --no-warn-ignored \
< "$RUNNER_TEMP/changed-docsite-files"
# Each Node process of the two type-aware steps, or of the docs lane's
# ESLint step, recorded its live heap.
# The report names the one nearest its limit, or one that did not
# finish, and warns at 80%, before core's TypeScript program outgrows
# the heap. It runs after a failed lint wherever setup ran, and it
# never fails the job.
- name: Report the lint heap peak
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
continue-on-error: true
run: node .github/scripts/lint-heap-peak.mjs report "$RUNNER_TEMP/lint-heap-peaks.jsonl"