Updated README.md #4523
This file contains 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
name: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
shellcheck: | |
name: Run shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: shellcheck | |
uses: reviewdog/[email protected] | |
lint: | |
name: Run Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
- name: Setup Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: yarn | |
cache-dependency-path: test-app/yarn.lock | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: test-app | |
- name: Run Stylelint | |
run: yarn stylelint | |
working-directory: test-app | |
- name: Run ESLint for a nested project with changed files and .eslintignore | |
uses: ./ | |
with: | |
path: "test-app" | |
config_path: "eslint.config.mjs" | |
file_extensions: | | |
**/*.ts | |
**/*.tsx | |
extra_args: "--max-warnings=0" | |
ignore_patterns: "src/reportWebVitals.ts" | |
escape_paths: false | |
- name: Fix Lint Errors | |
if: failure() | |
run: yarn stylelint:fix | |
working-directory: test-app | |
- name: Fix ESLint errors for a nested project with changed files and .eslintignore | |
if: failure() | |
uses: ./ | |
with: | |
path: "test-app" | |
config_path: "eslint.config.mjs" | |
file_extensions: | | |
**/*.ts | |
**/*.tsx | |
escape_paths: false | |
extra_args: "--fix" | |
skip_annotations: true | |
ignore_patterns: "src/reportWebVitals.ts" | |
- name: Verify Changed files | |
if: failure() | |
uses: tj-actions/verify-changed-files@v20 | |
id: verify-changed-files | |
with: | |
files: | | |
**/*.{ts,tsx} | |
- name: Commit outstanding changes | |
if: failure() && steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add ${{ steps.verify-changed-files.outputs.changed_files }} | |
git commit -m "lint fixes." | |
- name: Push changes | |
if: failure() && steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PAT_TOKEN }} | |
branch: ${{ github.head_ref }} | |
eslint-changed-files: | |
runs-on: ${{ matrix.platform }} | |
needs: | |
- lint | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-latest | |
# - windows-latest | |
- macos-latest | |
fetch-depth: [0, 1] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: ${{ matrix.fetch-depth }} | |
- name: Setup Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: yarn | |
cache-dependency-path: test-app/yarn.lock | |
- name: Install dependencies | |
run: yarn | |
working-directory: test-app | |
- name: Run ESLint on changed files | |
uses: ./ | |
with: | |
path: "test-app" | |
config_path: "eslint.config.mjs" | |
file_extensions: | | |
**/*.ts | |
**/*.tsx | |
escape_paths: false | |
extra_args: "--max-warnings=0" | |
ignore_patterns: "src/reportWebVitals.ts" | |
- name: Run ESLint on all files | |
uses: ./ | |
with: | |
path: "test-app" | |
config_path: "eslint.config.mjs" | |
file_extensions: | | |
**/*.ts | |
**/*.tsx | |
extra_args: "--max-warnings=0" | |
all_files: true | |
- name: Run ESLint on all files without a config_path on all files | |
uses: ./ | |
with: | |
path: "test-app" | |
file_extensions: | | |
**/*.ts | |
**/*.tsx | |
extra_args: "--max-warnings=0" | |
all_files: true |