Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,32 @@ jobs:
- name: Setup Node
uses: ./.github/actions/composite/setupNode

- name: Remove E/App version from package-lock.json
# Extract only the lint-affecting dependencies: eslint packages, the parser chain
# (espree/acorn) whose bumps can silently change parse results, plus
# typescript/ts-api-utils since a TS bump can change type-aware lint results.
# The cache key hashes this slice so a cold full re-lint happens only when
# the lint config or a lint dependency changes -- not on every dep bump.
- name: Extract lint-related deps from package-lock.json
shell: bash
run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json
run: |
jq '{packages: (.packages | to_entries | map(select(.key | test("eslint|espree|acorn|^node_modules/(typescript|ts-api-utils)$"))) | from_entries)}' package-lock.json > lint-deps-lock.json

# The setupNode sticky disk persists all of node_modules between runs, including
# node_modules/.cache/eslint. Clear it so the restore step below is the only cache
# source -- a restore miss doesn't delete pre-existing files, so without this a
# config change would silently reuse the stale cache carried over by the disk.
- name: Clear ESLint cache carried over by the node_modules sticky disk
shell: bash
run: rm -rf node_modules/.cache/eslint

- name: Restore ESLint cache
# v5.0.1
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb
with:
path: node_modules/.cache/eslint
key: ${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'normalized-package-lock.json') }}-${{ github.sha }}
key: ${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'lint-deps-lock.json') }}-${{ github.sha }}
Comment thread
VickyStash marked this conversation as resolved.
Resolved
restore-keys: |
${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'normalized-package-lock.json') }}-
${{ runner.os }}-eslint-
${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'lint-deps-lock.json') }}-

# ESLint's cache doesn't track cross-file TypeScript dependencies, which can cause stale errors.
# If lint fails, we clear the cache and retry to rule out false positives.
Expand All @@ -69,7 +82,7 @@ jobs:
if: always()
with:
path: node_modules/.cache/eslint
key: ${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'normalized-package-lock.json') }}-${{ github.sha }}
key: ${{ runner.os }}-eslint-${{ hashFiles('eslint.config.mjs', 'config/eslint/**', 'lint-deps-lock.json') }}-${{ github.sha }}

# If lint tightened the seatbelt baseline (i.e. fewer baselined errors than last time),
# commit the updated TSV back to `main` as OSBotify. Only runs under `workflow_call`
Expand Down
Loading