CI: run npm ci once via composite action + artifact sharing#182
CI: run npm ci once via composite action + artifact sharing#182sfreeman422 merged 5 commits intofeature/add-ci-checksfrom
Conversation
Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/4c494880-0851-4259-9bf2-0172fcf671c4
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions CI workflow to avoid repeated dependency installs by introducing a dedicated dependency setup job and a reusable composite action that restores dependencies via artifacts, while also tightening default workflow permissions.
Changes:
- Added a
setupjob that runsnpm cionce and uploadsnode_modulesas an artifact for downstream jobs. - Updated lint/format-check/build/test jobs to depend on
setupand use a new composite action to set up Node.js + download the artifact. - Added workflow-level
permissions: contents: read(intended as a security hardening change).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/ci.yml | Adds a dependency-setup job and shifts other jobs to consume dependencies from an artifact; introduces workflow-level token permissions. |
| .github/actions/setup/action.yml | New composite action to standardize Node setup and dependency restoration from the artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| permissions: | ||
| contents: read | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/9c6de18d-4d6d-4a01-a0c4-6091c6499711
|
@copilot most of the steps are failing with errors related to being unable to find specific packages such as jest, eslint, prettier, etc - do each the format check, lint and test & coverage steps leverage the one time npm ci run correctly? |
…download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/c08c9005-bef2-4528-b4ab-b197997e8da9
The root cause was that Fixed in commit |
|
@copilot still not working:
|
…ifact upload/download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/95656348-9a9c-4213-a56b-4604864084e8
The root cause was that Fixed in commit |
* Added github actions flow for CI concerns * Update .github/workflows/ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Added support for linting spec files * Updated to use an ESLint specific tsconfig * Updated eslint config to properly leverage the right tsconfig * CI: run npm ci once via composite action + artifact sharing (#182) * Initial plan * Refactor CI to use composite action + artifacts to avoid repeated npm ci Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/4c494880-0851-4259-9bf2-0172fcf671c4 * Fix actions permissions for artifact upload/download in CI workflow Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/9c6de18d-4d6d-4a01-a0c4-6091c6499711 * Fix: restore execute permissions on node_modules/.bin after artifact download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/c08c9005-bef2-4528-b4ab-b197997e8da9 * Fix: tar node_modules to preserve symlinks and permissions across artifact upload/download Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/95656348-9a9c-4213-a56b-4604864084e8 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com>
.github/actions/setup/action.ymlcomposite action (setup-node + download artifact)ci.yml: addsetupjob (npm ci + upload artifact), update lint/format-check/build/test to use composite action instead of running npm ci each timepermissions: contents: readat workflow level (CodeQL security fix)actions: writetosetupjob andactions: readto downstream jobs so artifact upload/download work correctlynode_modules/.binafter artifact download —actions/upload-artifactuses zip format which doesn't preserve Unix symlinks; switched to tar/gzip thenode_modulesdirectory before upload and untar after download, which fully preserves symlinks and executable permissions⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.