Repository navigation
chore: [] add copilot setup (NPM) - #2378
Steffen Neubauer (stefreak) wants to merge 1 commit into
Conversation
WalkthroughA new GitHub Actions workflow is added that automates Node.js setup and dependency installation. The workflow triggers on manual dispatch, push, and pull request events. It configures npm to use GitHub Packages with a read-only token and runs npm ci for reproducible installations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/copilot-setup-steps.yml(1 hunks)
| - name: set up global .npmrc | ||
| run: | | ||
| echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN_PACKAGES_READONLY}' >> $HOME/.npmrc | ||
| echo 'ignore-scripts=true' >> $HOME/.npmrc | ||
|
|
||
| - name: Install JavaScript dependencies | ||
| run: npm ci | ||
| env: | ||
| GITHUB_TOKEN_PACKAGES_READONLY: ${{ github.token }} |
There was a problem hiding this comment.
Environment variable not available when .npmrc is configured; token won't be authenticated.
The GITHUB_TOKEN_PACKAGES_READONLY environment variable is defined in the env: block of the "Install JavaScript dependencies" step (lines 44-45), but it's needed in the "set up global .npmrc" step (lines 37-40) where it's referenced. When the echo command runs on line 39, the variable doesn't exist in the environment, so npm will write the literal string ${GITHUB_TOKEN_PACKAGES_READONLY} to .npmrc instead of the actual token value. This will cause authentication failures for GitHub Packages.
Additionally, line 37 has a capitalization inconsistency: "set up" should be "Set up" to match other step names.
Apply this diff to fix the scoping issue and capitalization:
- - name: set up global .npmrc
+ - name: Set up global .npmrc
run: |
echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN_PACKAGES_READONLY}' >> $HOME/.npmrc
echo 'ignore-scripts=true' >> $HOME/.npmrc
+ env:
+ GITHUB_TOKEN_PACKAGES_READONLY: ${{ github.token }}
- name: Install JavaScript dependencies
run: npm ci
- env:
- GITHUB_TOKEN_PACKAGES_READONLY: ${{ github.token }}🤖 Prompt for AI Agents
.github/workflows/copilot-setup-steps.yml around lines 37 to 45: the step that
writes the global .npmrc references GITHUB_TOKEN_PACKAGES_READONLY but that env
is only set on the later "Install JavaScript dependencies" step, so the token
isn't available when echo runs; change the step name capitalization to "Set up
global .npmrc" and move or add the GITHUB_TOKEN_PACKAGES_READONLY environment
variable to the .npmrc step (or define it at the job level) so the token expands
during the echo command, ensuring the credential is written correctly.
|
Copilot setup only necessary for private repositories |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.