Skip to content

Feed selector new look #82812

Feed selector new look

Feed selector new look #82812

Workflow file for this run

name: Changed files ESLint check
on:
workflow_call:
pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths: ['**.js', '**.ts', '**.tsx', '**.json', '**.mjs', '**.cjs', 'config/.editorconfig', '.watchmanconfig', '.imgbotconfig']
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-changed-lint
cancel-in-progress: true
jobs:
lint-changed:
name: Changed files ESLint check
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Count commits between merge base and HEAD
id: count
run: |
# Compare the base commit and HEAD to get the count of commits after base
# up to and including HEAD. Add 2 to this total when fetching history.
#
# When opening a PR, GitHub will create a merge commit that squashes
# your changes for use in the workflow. So your history locally
# may look like
# o---o---o---B - development
# /
# ---o---1---C---o---o---A - main
# Note that the `1` is the merge-base of development and main. The
# number of commits after `1` upto and including `A` is 4.
# In the workflow, GitHub squashs development, so it becomes:
# ---o---1---C---o---o---A - main
# \--M - PR branch
# Where `M`` is the new squashed commit. To fetch enough history to
# include the merge base, we need to fetch `M`, `A` through `C` and
# `1` for total of 4+2=6 commits. The +2 commits accounts for the
# base `1` and merge commit `M`.
RAW_COUNT="$(gh api "repos/$REPO/compare/${BASE}...main" | jq -r '.total_commits')"
ADJUSTED_COUNT=$((RAW_COUNT + 2))
echo "count=$ADJUSTED_COUNT" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
BASE: ${{ github.event.pull_request.base.sha }}
REPO: ${{ github.repository }}
- name: Checkout
# v4
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
fetch-depth: ${{ fromJSON(steps.count.outputs.count) }}
- name: Setup Node
uses: ./.github/actions/composite/setupNode
- name: Remove E/App version from package-lock.json
shell: bash
run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json
- name: Restore ESLint cache
# v5.0.1
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb
with:
path: node_modules/.cache/eslint-changed
key: ${{ runner.os }}-eslint-changed-${{ hashFiles('eslint.changed.config.*', 'normalized-package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-eslint-changed-${{ hashFiles('eslint.changed.config.*', 'normalized-package-lock.json') }}-
${{ runner.os }}-eslint-changed-
# 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.
# See: https://typescript-eslint.io/troubleshooting/faqs/eslint/#can-i-use-eslints---cache-with-typescript-eslint
- name: Run ESLint to check for deprecation warnings
run: |
if ! npm run lint-changed; then
echo "Lint failed, clearing cache and retrying..."
rm -rf node_modules/.cache/eslint-changed
npm run lint-changed
fi
- name: Save ESLint cache
# v5.0.1
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb
if: always()
with:
path: node_modules/.cache/eslint-changed
key: ${{ runner.os }}-eslint-changed-${{ hashFiles('eslint.changed.config.*', 'normalized-package-lock.json') }}-${{ github.sha }}