Skip to content

Commit

Permalink
[CI] Only run eslint on files that are different from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
In3luki committed Apr 27, 2024
1 parent 88cc55d commit 4fd56ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
37 changes: 12 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: PF2e System CI

on:
pull_request:
branches: [master]
branches: [master, v12]
push:
branches: [master, release-v9]
branches: [master]
workflow_dispatch:
branches: [master, release-v9]
branches: [master]

jobs:
build:
Expand All @@ -19,27 +19,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache NPM Deps
id: cache-npm
uses: actions/cache@v3
- name: List all changed files
uses: tj-actions/changed-files@v44
# To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g
with:
path: node_modules/
key: npm-${{ hashFiles('package-lock.json') }}

- name: Install NPM Deps
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Build
run: |
npm run build
- name: Test
since_last_remote_commit: true
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
npm run test
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"hot": "vite serve",
"link": "tsx ./build/link-foundry.ts",
"extractPacks": "tsx ./build/extract-packs.ts",
"pretest": "npm run lint",
"test": "jest",
"test": "npm run lint && jest",
"test:ci": "npm run lint:ci && jest",
"migrate": "tsx ./build/run-migration.ts",
"lint": "npm run lint:ts && npm run lint:json && npm run prettier:scss",
"lint:ci": "eslint $(git diff --name-only --diff-filter=ACMRTUXB upstream/master | grep -E \"^[src|build|tests|types].*\\.ts$\") && npm run lint:json && npm run prettier:scss",
"lint:ts": "eslint ./build ./src ./tests ./types --ext .ts",
"prettier:scss": "prettier --check src/styles",
"lint:json": "eslint ./static --ext .json --no-eslintrc --plugin json --rule \"json/*: error\" --rule \"linebreak-style: error\"",
Expand Down
2 changes: 1 addition & 1 deletion src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ declare global {
};
PF2E: typeof PF2ECONFIG;
time: {
roundTime: number;
roundTime: any;
};
}

Expand Down

0 comments on commit 4fd56ec

Please sign in to comment.