-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add workflow permissions and npm provenance #16
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
Changes from all commits
be372f9
f7b6043
316b686
7e42f54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,26 +6,28 @@ on: | |||||
| pull_request: | ||||||
| branches: [ main, develop ] | ||||||
|
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Fix: Add a |
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| env: | ||||||
| NODE_VERSION: '22' | ||||||
|
|
||||||
| jobs: | ||||||
| test: | ||||||
| runs-on: ubuntu-latest | ||||||
|
|
||||||
| strategy: | ||||||
| matrix: | ||||||
| node-version: ['22.x'] | ||||||
|
|
||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
| - name: Use Node.js ${{ matrix.node-version }} | ||||||
|
|
||||||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||||||
| uses: actions/setup-node@v4 | ||||||
| with: | ||||||
| node-version: ${{ matrix.node-version }} | ||||||
| node-version: ${{ env.NODE_VERSION }} | ||||||
| cache: 'npm' | ||||||
|
|
||||||
| - name: Install dependencies | ||||||
| run: npm ci | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Error The Fix: Standardize on a single package manager for the project. If
Suggested change
|
||||||
|
|
||||||
| - name: Run linting (if configured) | ||||||
| run: | | ||||||
| if npm run lint --silent 2>/dev/null; then | ||||||
|
|
@@ -34,19 +36,18 @@ jobs: | |||||
| echo "No linting configured, skipping..." | ||||||
| fi | ||||||
| continue-on-error: false | ||||||
|
|
||||||
| - name: Run tests | ||||||
| run: npm test | ||||||
|
|
||||||
| - name: Run build | ||||||
| run: npm run build | ||||||
|
|
||||||
| - name: Check for vulnerabilities | ||||||
| run: npm audit --omit=dev | ||||||
| run: npm audit --omit=dev --audit-level=high || echo "::warning::npm audit found vulnerabilities (see above)" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning The Fix: Consider explicitly setting an
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Fix: Consider making the |
||||||
|
|
||||||
| - name: Upload coverage to Codecov (if exists) | ||||||
| uses: codecov/codecov-action@v3 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ Info The condition Fix: Remove the redundant
Suggested change
|
||||||
| if: matrix.node-version == '22.x' | ||||||
| continue-on-error: true | ||||||
| with: | ||||||
| file: ./coverage/lcov.info | ||||||
|
|
@@ -56,38 +57,38 @@ jobs: | |||||
| build-check: | ||||||
| runs-on: ubuntu-latest | ||||||
| needs: test | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
| - name: Use Node.js 20.x | ||||||
|
|
||||||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||||||
| uses: actions/setup-node@v4 | ||||||
| with: | ||||||
| node-version: '20.x' | ||||||
| node-version: ${{ env.NODE_VERSION }} | ||||||
| cache: 'npm' | ||||||
|
|
||||||
| - name: Install dependencies | ||||||
| run: npm ci | ||||||
|
|
||||||
| - name: Build package | ||||||
| run: npm run build | ||||||
|
|
||||||
| - name: Check dist files exist | ||||||
| run: | | ||||||
| if [ ! -d "dist" ]; then | ||||||
| echo "❌ dist directory not found!" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| if [ ! -f "dist/index.js" ]; then | ||||||
| echo "❌ dist/index.js not found!" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| echo "✅ Build artifacts verified" | ||||||
|
|
||||||
| - name: Package size check | ||||||
| run: | | ||||||
| npm pack --dry-run | ||||||
| size=$(du -sh . | cut -f1) | ||||||
| echo "📦 Package size: $size" | ||||||
| echo "📦 Package size: $size" | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Warning
The current CI workflow for
ci.ymlis triggered only onpull_requestevents formainanddevelopbranches. This means that direct pushes to these branches, or any other branch, will not trigger the CI workflow. This can lead to situations where code is pushed directly to the main or develop branch without being fully tested by the CI pipeline, potentially introducing regressions or untested code.Fix: Add
pushevents as a trigger for the CI workflow to ensure that all pushes to the specified branches (main, develop) also run the CI checks. This provides more comprehensive testing and prevents untested code from being merged or deployed. It also provides immediate feedback on the health of the branch after a direct push.🤖 Prompt for AI Agents