Skip to content
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
15 changes: 15 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Setup Node.js with cached dependencies'
description: 'Sets up Node.js and restores node_modules from the artifact uploaded by the setup job.'

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: actions/download-artifact@v4
with:
name: node-modules
path: .
- run: tar -xzf node-modules.tar.gz && rm node-modules.tar.gz
shell: bash
57 changes: 40 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,75 @@ on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

Comment on lines +7 to +9
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow-level permissions block sets only contents: read, which disables other default GITHUB_TOKEN scopes. actions/upload-artifact / actions/download-artifact require actions permissions, so the new artifact-based setup is likely to fail with permission errors. Consider adding actions: write for the setup job (upload) and actions: read for the dependent jobs (download), either at workflow level or overridden per job.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 2396c37. Added actions: write to the setup job (needed for upload-artifact) and actions: read to each of the downstream lint, format-check, build, and test jobs (needed for download-artifact), while keeping the workflow-level default of contents: read.

jobs:
lint:
name: Lint
setup:
name: Install Dependencies
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: tar -czf node-modules.tar.gz node_modules
- uses: actions/upload-artifact@v4
with:
name: node-modules
path: node-modules.tar.gz
retention-days: 1

lint:
name: Lint
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: npm run lint

format-check:
name: Format Check
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- uses: ./.github/actions/setup
- run: npm run format:check

build:
name: Build
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- uses: ./.github/actions/setup
- run: npm run build

test:
name: Test & Coverage
needs: setup
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- uses: ./.github/actions/setup
- name: Enforce 80% coverage
run: npm run test:coverage
Loading