Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: adds GH action that calculates rule diff #270

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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