Skip to content

Commit

Permalink
ci: adds GH action that calculates rule diff (#270)
Browse files Browse the repository at this point in the history
Fixes #266
  • Loading branch information
voxpelli committed Dec 7, 2023
1 parent afee23e commit 5381e0e
Show file tree
Hide file tree
Showing 4 changed files with 674 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/rule-diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Rule Diff

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

permissions:
contents: read

jobs:
diff:
name: Generate diff
runs-on: ubuntu-latest
steps:
- name: Checkout the PR source
uses: actions/checkout@v4
with:
path: source
- name: Checkout target ref ${{ github.base_ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: target
- name: Use Node.js LTS
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Determine npm cache directory windows
id: npm-cache-dir-windows
if: runner.os == 'Windows'
run: echo "dir=$(npm config get cache)" >> $env:GITHUB_OUTPUT
- name: Determine npm cache directory non-windows
id: npm-cache-dir
if: runner.os != 'Windows'
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir-windows.outputs.dir || steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json', '**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install the PR source
run: 'npm ci --ignore-scripts --force'
working-directory: ./source
- name: install the PR target
run: 'npm ci --ignore-scripts --force'
working-directory: ./target

- name: run eslint
run: compare-eslint-configs .eslintrc ../target/.eslintrc -d -m --verbose-configs >> $GITHUB_STEP_SUMMARY
working-directory: ./source
2 changes: 1 addition & 1 deletion .knip.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"eslint": {
"config": [".eslintrc", "index.js", "esm.js", "mocha.js"]
},
"ignoreDependencies": ["@types/eslint"]
"ignoreDependencies": ["@types/eslint", "compare-eslint-configs"]
}
Loading

0 comments on commit 5381e0e

Please sign in to comment.