Add a workflow to separate out eslint and annotate PRs. (#39704)
This commit is contained in:
parent
3611fafe79
commit
45c49dc232
|
@ -0,0 +1,40 @@
|
|||
name: Lint JS packages
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
lint-test-js:
|
||||
name: Lint
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
# This is required to allow the action to annotate the PR with the linting results.
|
||||
checks: write
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
|
||||
continue-on-error: true
|
||||
|
||||
- name: Collect and Combine Eslint Reports
|
||||
run: node ./.github/workflows/scripts/collect-eslint-reports.js
|
||||
|
||||
- name: Annotate Code Linting Results
|
||||
uses: ataylorme/eslint-annotate-action@a1bf7cb320a18aa53cb848a267ce9b7417221526
|
||||
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
report-json: 'combined_eslint_report.json'
|
|
@ -12,7 +12,7 @@ permissions: {}
|
|||
|
||||
jobs:
|
||||
lint-test-js:
|
||||
name: Lint and Test JS
|
||||
name: Run JS Tests
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -22,8 +22,5 @@ jobs:
|
|||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
|
||||
|
||||
- name: Test
|
||||
run: pnpm run test --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/api' --color
|
|
@ -0,0 +1,34 @@
|
|||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const rootDirectory = path.resolve( __dirname, '..', '..', '..' );
|
||||
|
||||
const allReports = [];
|
||||
|
||||
function collectReports( directory ) {
|
||||
const files = fs.readdirSync( directory );
|
||||
for ( const file of files ) {
|
||||
const fullPath = path.join( directory, file );
|
||||
const isDirectory = fs.statSync( fullPath ).isDirectory();
|
||||
|
||||
if ( isDirectory && file !== 'node_modules' && file !== 'vendor' ) {
|
||||
const reportPath = path.join( fullPath, 'eslint_report.json' );
|
||||
if ( fs.existsSync( reportPath ) ) {
|
||||
// an array of items
|
||||
const report = require( reportPath );
|
||||
|
||||
// add the report to the allReports array
|
||||
allReports.push( ...report );
|
||||
}
|
||||
|
||||
collectReports( fullPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
collectReports( rootDirectory );
|
||||
|
||||
fs.writeFileSync(
|
||||
'combined_eslint_report.json',
|
||||
JSON.stringify( allReports, null, 2 )
|
||||
);
|
|
@ -22,8 +22,9 @@ none
|
|||
# Logs
|
||||
logs/
|
||||
|
||||
# Eslint Cache
|
||||
# Eslint
|
||||
.eslintcache
|
||||
eslint_report.json
|
||||
|
||||
# Environment files
|
||||
wp-cli.local.yml
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -60,7 +60,7 @@
|
|||
"prepare": "composer install",
|
||||
"changelog": "composer exec -- changelogger",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "tsc --project tsconfig.json --watch",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -33,7 +33,7 @@
|
|||
"changelog": "composer exec -- changelogger",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -79,7 +79,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -39,7 +39,7 @@
|
|||
"compile": "tsc --project tsconfig.json",
|
||||
"prepack": "pnpm run build",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"lint:fix": "eslint src --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -154,11 +154,11 @@
|
|||
"changelog": "composer exec -- changelogger",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src --ext=js,ts,tsx",
|
||||
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"lint:fix": "eslint src --ext=js,ts,tsx --fix",
|
||||
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
"test:update-snapshots": "pnpm run test -- --updateSnapshot",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -41,7 +41,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -44,7 +44,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -80,7 +80,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -87,7 +87,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -64,7 +64,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -42,7 +42,7 @@
|
|||
"scripts": {
|
||||
"prepare": "composer install",
|
||||
"changelog": "composer exec -- changelogger",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"lint:fix": "eslint src --fix"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"clean": "rm -rf ./build ./build-module",
|
||||
"compile": "e2e-builds",
|
||||
"lint": "eslint src --ext=js,ts,tsx",
|
||||
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
|
||||
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
|
||||
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
"test:e2e": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js",
|
||||
"test:e2e-debug": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev --debug",
|
||||
"test:e2e-dev": "bash ./bin/wait-for-build.sh && ./bin/e2e-test-integration.js --dev",
|
||||
"lint": "eslint src --ext=js,ts,tsx",
|
||||
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
|
||||
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
|
||||
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
|
||||
},
|
||||
"bin": {
|
||||
"wc-e2e": "bin/wc-e2e.sh"
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
"clean": "rm -rf ./build ./build-module",
|
||||
"compile": "e2e-builds",
|
||||
"prepack": "pnpm run build",
|
||||
"lint": "eslint src --ext=js,ts,tsx",
|
||||
"lint:fix": "eslint src --ext=js,ts,tsx --fix"
|
||||
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
|
||||
"lint:fix": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src --fix"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.(t|j)s?(x)": [
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -90,7 +90,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -62,7 +62,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"scripts": {
|
||||
"turbo:build": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"ts:check": "tsc --noEmit --project ./tsconfig.json",
|
||||
"clean": "pnpm exec rimraf *.tsbuildinfo build build-*",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -52,7 +52,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"turbo:build": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -38,7 +38,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -71,7 +71,7 @@
|
|||
"changelog": "composer exec -- changelogger",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -121,7 +121,7 @@
|
|||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
|
||||
"build:css": "webpack",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Make eslint emit JSON report for annotating PRs.
|
|
@ -37,7 +37,7 @@
|
|||
"changelog": "composer exec -- changelogger",
|
||||
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
|
||||
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint --output-file eslint_report.json --format json src",
|
||||
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
|
||||
"prepack": "pnpm run clean && pnpm run build",
|
||||
"lint:fix": "eslint src --fix"
|
||||
|
|
Loading…
Reference in New Issue