ci: add CI workflow for lint, typecheck and tests#35
Conversation
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: lts/* | ||
| cache: npm | ||
|
|
||
| - name: Install Rust stable | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
|
|
||
| - name: Rust cache | ||
| uses: swatinem/rust-cache@v2 | ||
| with: | ||
| workspaces: ./src-tauri -> target | ||
|
|
||
| - name: Install Linux dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | ||
|
|
||
| - name: Install frontend dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Biome lint | ||
| run: npx biome check . | ||
|
|
||
| - name: TypeScript check | ||
| run: npx tsc -b --noEmit | ||
|
|
||
| - name: Frontend tests | ||
| run: npx vitest run | ||
|
|
||
| - name: Rust clippy | ||
| working-directory: src-tauri | ||
| run: cargo clippy -- -D warnings | ||
|
|
||
| - name: Rust tests | ||
| working-directory: src-tauri | ||
| run: cargo test |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
In general, the fix is to add an explicit permissions: block that restricts the GITHUB_TOKEN to the minimal scopes required. Because this workflow only checks out code and runs local tools (lint, tests, TypeScript, Rust tooling) and does not appear to modify repository contents, create releases, or otherwise need write access, contents: read is a safe minimal baseline. You can define this at the workflow root so it applies to all jobs, or at the job level; here, putting it at the root keeps the file concise and still allows per‑job overrides later if needed.
Concretely, edit .github/workflows/ci.yml and insert a permissions: block right after the name: CI line (line 1). The block should be:
permissions:
contents: readThis will ensure the GITHUB_TOKEN is limited to read‑only repository contents for all jobs that do not override permissions. No additional imports, methods, or other definitions are required, as this is pure workflow configuration.
| @@ -1,4 +1,6 @@ | ||
| name: CI | ||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: |
Summary
.github/workflows/ci.ymlwith lint (Biome), typecheck (tsc), frontend tests (Vitest), Rust clippy, and Rust testsConventions
Part of org-wide CI/CD standardization effort.