From 5bc0400f881fcb727920ab47cc781df5493329ce Mon Sep 17 00:00:00 2001 From: MK Date: Sat, 17 Oct 2026 01:11:44 +0800 Subject: [PATCH 1/2] ci: add Fallow pull request audits --- .fallowrc.json | 4 ++ .github/workflows/fallow.yml | 33 +++++++++++++ .gitignore | 1 + CONTRIBUTING.md | 12 +++++ package.json | 1 + pnpm-lock.yaml | 96 ++++++++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 .fallowrc.json create mode 100644 .github/workflows/fallow.yml diff --git a/.fallowrc.json b/.fallowrc.json new file mode 100644 index 0000000..fe2d923 --- /dev/null +++ b/.fallowrc.json @@ -0,0 +1,4 @@ +{ + "$schema": "./node_modules/fallow/schema.json", + "entry": ["src/index.ts", "src/gitlab/index.ts", "src/azure/index.ts"] +} diff --git a/.github/workflows/fallow.yml b/.github/workflows/fallow.yml new file mode 100644 index 0000000..65d2329 --- /dev/null +++ b/.github/workflows/fallow.yml @@ -0,0 +1,33 @@ +name: Fallow + +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: fallow-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + audit: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + pull-requests: write + checks: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Audit pull request + uses: fallow-rs/fallow@fccff887da0d83db1711379e0a3696dfc2460fdd # v3.33.1 + with: + command: audit + # Fork and Dependabot PRs keep annotations and the job summary. + comment: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} + branded-token: false diff --git a/.gitignore b/.gitignore index 8f381c3..40ea6c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ .vitest/ +.fallow/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b1c8ee3..5be2546 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,6 +43,18 @@ Commit generated changes under `dist/` with the source changes. Include `dist/in The [pre-commit hook](.vite-hooks/pre-commit) runs `vp staged`. The staged-file configuration in [vite.config.ts](vite.config.ts) runs `vp check --fix` on staged files. Run the build yourself; the hook does not rebuild the bundles. +### Pull Request Analysis + +The [Fallow workflow](.github/workflows/fallow.yml) runs `fallow audit` on pull requests. It checks changed files for unused code, complexity, duplication, and styling issues. Only new findings can fail the check; existing findings do not block adoption. + +The action uses the exact `fallow` version in `package.json`. After `vp install`, run the same analysis locally: + +```bash +vp exec fallow audit --base origin/main +``` + +[`.fallowrc.json`](.fallowrc.json) declares the three runtime entry points. Fallow excludes generated files under `dist/` by default. Same-repository pull requests receive a result comment. Fork and Dependabot pull requests use annotations and the job summary. + ## Integration Design Use the shared primitives under [`src/ci/`](src/ci/) for portable runtime behavior. diff --git a/package.json b/package.json index 48935b6..726f024 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "devDependencies": { "@types/node": "^24.0.0", + "fallow": "3.33.1", "typescript": "^7.0.0", "vite": "catalog:", "vite-plus": "catalog:" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef7cc3b..39cd23f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -200,6 +200,9 @@ importers: '@types/node': specifier: ^24.0.0 version: 24.12.2 + fallow: + specifier: 3.33.1 + version: 3.33.1 typescript: specifier: ^7.0.0 version: 7.0.2 @@ -304,6 +307,46 @@ packages: '@blazediff/core@1.10.0': resolution: {integrity: sha512-AOQff0zgR7cGsZL+4E7hVkmujoPUpm0J9xzWGWZj5wCjd3gmxESXAPfKyuzs93VdpQNFhHlBhfOjrcZ+XTERtQ==} + '@fallow-cli/darwin-arm64@3.33.1': + resolution: {integrity: sha512-Bv3l9gDcNttmE7MkRXCWbVNMq4HcQ7Jm7swkAoBR6eoTpImU19R+gyXtmdFLxT7yvJlSxGbg7CTBx+8mkEOXgw==} + cpu: [arm64] + os: [darwin] + + '@fallow-cli/darwin-x64@3.33.1': + resolution: {integrity: sha512-dnUlmcJe7Gm1OMFOch0wENCYkNEeI8/xwfnYHljAWuwA01TwOouBQDuhlUH5/PhrDX+aO6i4hXjNVoRaaNt9BQ==} + cpu: [x64] + os: [darwin] + + '@fallow-cli/linux-arm64-gnu@3.33.1': + resolution: {integrity: sha512-IbF+myjfVmUqzyazdbsZzf/OdH8syf1DRqi8dBBq2x/ihCo9ZGuX5X5VqOfW2vKsSh5kba0FmmD5YjOo6RmGvQ==} + cpu: [arm64] + os: [linux] + + '@fallow-cli/linux-arm64-musl@3.33.1': + resolution: {integrity: sha512-p/Y5Y6cl/mEoJROu1aDbzqvCZ99sRH+xwkDn+P7gdYAevzsOZgBVXN/Ijq+HFSLiKpE5M9dJ5dki3XGzR5+6pA==} + cpu: [arm64] + os: [linux] + + '@fallow-cli/linux-x64-gnu@3.33.1': + resolution: {integrity: sha512-XaJEeutezIeW/IlWRvKtK7IpEjgX9rh/XTAHrzoUqlwkzO8kalD53mFLnuJ42UET9yrw+c49Xh9AO+a9++rwyw==} + cpu: [x64] + os: [linux] + + '@fallow-cli/linux-x64-musl@3.33.1': + resolution: {integrity: sha512-lBRNVdzFIrR5N8FiuhyLOiStAnxM46vbw8N84Ugd5wphEGjz/y1yESmJ4vr4rJ960HiqhphBabtsrGrRBcZwcw==} + cpu: [x64] + os: [linux] + + '@fallow-cli/win32-arm64-msvc@3.33.1': + resolution: {integrity: sha512-MW7HVd1C8mS33nOKup5mzkJFgwdxYXKdAZMf2HPMePkGWb3LrS8wsTcJ5RyHx3FomD81y+2FB/VapWasPK9g6A==} + cpu: [arm64] + os: [win32] + + '@fallow-cli/win32-x64-msvc@3.33.1': + resolution: {integrity: sha512-+Km++qhiUZpIxI+JheZns11ETxikQwBR2mMvrp45a/bzxjIN12EHQaJ2mlUbLLWkwR8b7DQVUH7TjwWe35uOyA==} + cpu: [x64] + os: [win32] + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -1059,6 +1102,16 @@ packages: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} + fallow-type-aware@3.33.1: + resolution: {integrity: sha512-YDq+INBmAFk2KpOnX1T97McttUsRwMO0UGpF0gk6CE/R9oVbaYyqUULF7/2XzdGAeOejnhIwCGORCfeCQwfo9Q==} + engines: {node: '>=20'} + hasBin: true + + fallow@3.33.1: + resolution: {integrity: sha512-+fZdeFsb5Fv2/l8WRdjD/eT1D2iRg8q5/0GRyfzV5GRsNCIUnndT7IAdr0q+ZKqH2lVHArkGvDRtVgLwXSMpeA==} + engines: {node: '>=22'} + hasBin: true + fast-xml-builder@1.3.0: resolution: {integrity: sha512-F74cZEdCvuw9P41GAC3rod4X04jjWGM1JPEv/GWSqFTWLsdyMSBMBMlm9Hk3GLBgLBbdBNY8yee0pQh2RBVESQ==} @@ -1599,6 +1652,30 @@ snapshots: '@blazediff/core@1.10.0': {} + '@fallow-cli/darwin-arm64@3.33.1': + optional: true + + '@fallow-cli/darwin-x64@3.33.1': + optional: true + + '@fallow-cli/linux-arm64-gnu@3.33.1': + optional: true + + '@fallow-cli/linux-arm64-musl@3.33.1': + optional: true + + '@fallow-cli/linux-x64-gnu@3.33.1': + optional: true + + '@fallow-cli/linux-x64-musl@3.33.1': + optional: true + + '@fallow-cli/win32-arm64-msvc@3.33.1': + optional: true + + '@fallow-cli/win32-x64-msvc@3.33.1': + optional: true + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.6.0': {} @@ -2049,6 +2126,25 @@ snapshots: expect-type@1.4.0: {} + fallow-type-aware@3.33.1: + dependencies: + typescript: 7.0.2 + optional: true + + fallow@3.33.1: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + '@fallow-cli/darwin-arm64': 3.33.1 + '@fallow-cli/darwin-x64': 3.33.1 + '@fallow-cli/linux-arm64-gnu': 3.33.1 + '@fallow-cli/linux-arm64-musl': 3.33.1 + '@fallow-cli/linux-x64-gnu': 3.33.1 + '@fallow-cli/linux-x64-musl': 3.33.1 + '@fallow-cli/win32-arm64-msvc': 3.33.1 + '@fallow-cli/win32-x64-msvc': 3.33.1 + fallow-type-aware: 3.33.1 + fast-xml-builder@1.3.0: dependencies: path-expression-matcher: 1.6.2 From 3f7bb6d35022bda1c797bd00b79c304f7dd99bfd Mon Sep 17 00:00:00 2001 From: MK Date: Sat, 17 Oct 2026 01:12:51 +0800 Subject: [PATCH 2/2] ci: install dependencies before Fallow analysis --- .github/workflows/fallow.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/fallow.yml b/.github/workflows/fallow.yml index 65d2329..3c0eb5f 100644 --- a/.github/workflows/fallow.yml +++ b/.github/workflows/fallow.yml @@ -24,6 +24,11 @@ jobs: fetch-depth: 0 persist-credentials: false + - name: Setup Vite+ and install dependencies + uses: ./ + with: + node-version-file: .node-version + - name: Audit pull request uses: fallow-rs/fallow@fccff887da0d83db1711379e0a3696dfc2460fdd # v3.33.1 with: