Skip to content

(fix) GitHub Actions fixes from repo refactor #16657

(fix) GitHub Actions fixes from repo refactor

(fix) GitHub Actions fixes from repo refactor #16657

name: Pull Request Checks
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
on:
pull_request:
branches:
- master
jobs:
spellcheck:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
name: Checkout
- uses: Ana06/[email protected]
id: changed_files
name: Get changed files
- id: md_changed_files
name: Spellcheck Markdown files
run: |-
files=''
for f in ${{ steps.changed_files.outputs.added_modified }}
do
ext="${f##*.}"
if [ $ext = "md" ] || [ $ext = "mdx" ]
then
files="${f} ${files}"
fi
done
echo "files=${files}" >> $GITHUB_ENV
- uses: rojopolis/[email protected]
name: Spellcheck
if: ${{ env.files }}
with:
source_files: ${{ env.files }}
task_name: Markdown
lint:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
# See https://github.com/actions/checkout#checkout-v2
# This will be slow. The intent is to fetch all commits
# since the merge-base (the commit where we branched off)
# so we can check the git diff against all changed files.
# By default, the checkout action only returns the last commit,
# There's no native way to do this in the checkout action, so
# we have to fetch the entire history. See
# https://github.com/actions/checkout/issues/266#issuecomment-638346893
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: 9.14.2
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install -r
- name: Setup Node Env
uses: actions/[email protected]
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
# ESLint only on changed files
- name: Get Changed Files (space-separated)
id: changed_files_space
uses: Ana06/[email protected]
with:
format: 'space-delimited'
- name: Lint changed files
run: pnpm exec eslint ${{ steps.changed_files_space.outputs.added_modified }} ${{ steps.changed_files_space.outputs.renamed }}
- name: Get Changed Files (comma-separated)
id: changed_files
uses: Ana06/[email protected]
with:
format: 'csv'
# NOTE: These steps are kept in this workflow to avoid re-rerunning the rest of the lint job
# in the Components Checks workflow
- name: Check component keys
run: node scripts/findBadKeys.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }}
- name: Check component app prop
run: node scripts/checkComponentAppProp.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }}
- name: Check for duplicate component keys
run: node scripts/findDuplicateKeys.js