-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance CI workflow with security and reproducibility #4
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
Conversation
Added minimal permissions to reduce GitHub token exposure and switched to using pnpm's frozen lockfile for reproducible dependency installs. Improved artifact upload for coverage reports and build outputs, and made formatting consistent throughout the workflow.
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.
Pull Request Overview
This PR enhances the CI/CD pipeline with security improvements and build reproducibility. The changes add minimal GitHub token permissions to follow the principle of least privilege, enforce frozen lockfile installs to ensure reproducible builds, and improve artifact handling for test coverage and build outputs.
- Added minimal permissions (
contents: read) at the workflow level to reduce security risks - Switched to
pnpm install --frozen-lockfileacross all jobs for reproducible dependency installations - Enhanced artifact upload for coverage reports and improved consistency in formatting
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/workflows/ci.yml
Outdated
| path: | | ||
| coverage | ||
| coverage/**/* |
Copilot
AI
Nov 20, 2025
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.
The path specification is redundant. The pattern coverage already matches the directory and coverage/**/* adds no additional coverage. Simplify to just coverage/ to capture the entire directory contents.
| path: | | |
| coverage | |
| coverage/**/* | |
| path: coverage/ |
.github/workflows/ci.yml
Outdated
| run: pnpm run test | ||
|
|
||
| - name: Upload coverage artifact (if produced) | ||
| if: always() |
Copilot
AI
Nov 20, 2025
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.
Using if: always() will attempt to upload artifacts even when the test step is skipped or cancelled, not just on failure. Consider using if: success() || failure() instead to only upload when tests actually run but potentially fail, avoiding unnecessary uploads when the workflow is cancelled or skipped.
| if: always() | |
| if: success() || failure() |
| runs-on: ubuntu-latest | ||
| needs: [build] | ||
| needs: [ build ] | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
Copilot
AI
Nov 20, 2025
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.
The docker job builds and caches Docker images but has only contents: read permission. If this job needs to use GitHub Actions cache (type=gha), it requires actions: write permission. Consider adding job-level permissions or documenting that the cache operations may fail silently with the current minimal permissions.
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| actions: write |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@CorentynDevPro I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you. |
- Changed coverage artifact upload condition to `success() || failure()` - Simplified coverage artifact path to `coverage/` - Added `actions: write` permission to docker job Co-authored-by: CorentynDevPro <[email protected]>
Apply bot review comments: fix coverage upload condition and docker permissions
Added minimal permissions to reduce GitHub token exposure and switched to using pnpm's frozen lockfile for reproducible dependency installs. Improved artifact upload for coverage reports and build outputs, and made formatting consistent throughout the workflow.