Repository navigation
55 lines (46 loc) · 1.63 KB
/
Copy pathknip.yml
File metadata and controls
55 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Knip check
on:
pull_request:
types: [opened, synchronize]
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- '**.mjs'
- '**.cjs'
- 'knip.json'
- 'package.json'
- 'package-lock.json'
- 'patches/**'
- '**/tsconfig*.json'
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-knip
cancel-in-progress: true
jobs:
knip-compare:
name: Compare knip issues against main
if: github.actor != 'os-botify[bot]'
runs-on: blacksmith-2vcpu-ubuntu-2404-arm
env:
# Use the PR's target branch so staging and production PRs are not compared with main.
BASE_REF: ${{ github.base_ref || 'main' }}
steps:
- name: Checkout PR
uses: useblacksmith/checkout@0647fdbab2614a5eb86d2971070e325060d91056 # v1.7.0
- name: Setup Node
uses: ./.github/actions/composite/setupNode
with:
WORKSPACES: '["server/victory-chart-renderer", "web/cloudflare-worker"]'
- name: Run knip on PR
run: KNIP=true npx knip --reporter json --no-exit-code > /tmp/knip-pr.json
- name: Checkout base branch
run: |
git fetch origin "$BASE_REF" --no-tags --depth=1
git checkout "origin/$BASE_REF"
- name: Run knip on base branch
run: KNIP=true npx knip --reporter json --no-exit-code > /tmp/knip-main.json
- name: Restore PR workspace
run: git checkout ${{ github.sha }}
- name: Compare reports
run: npx bun ./scripts/compareKnipReports.ts --mainPath=/tmp/knip-main.json --prPath=/tmp/knip-pr.json