[WIP] Fix SSH authentication error in npm ci for GitHub script dependency#11043
Closed
[WIP] Fix SSH authentication error in npm ci for GitHub script dependency#11043
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.
Original prompt
This section details on the original issue you should resolve
<issue_title>[CI Failure Doctor] npm ci fails with SSH authentication error for @actions/github-script dependency</issue_title>
<issue_description>## Summary
The CI failed on the main branch after merging PR #11029. Three jobs (
lint-js,js, andbuild) all failed during thenpm cistep with SSH authentication errors when trying to install the@actions/github-scriptdependency.Failure Details
lint-js- Failed at "Install npm dependencies" stepjs- Failed at "Install npm dependencies" stepbuild- Failed at "npm ci" stepRoot Cause Analysis
PR #11029 added new
package.jsonandpackage-lock.jsonfiles toactions/setup/js/. The issue stems from how the@actions/github-scriptdependency is specified and locked:In
package.json(line 6):In
package-lock.json:When the
package-lock.jsonwas generated on the developer's machine, npm resolved thegithub:actions/github-scriptshorthand to agit+ssh://URL. This happened because their local git configuration was set to use SSH for GitHub.When
npm ciruns in CI, it uses the exact URLs frompackage-lock.json(that's the whole point ofnpm ci- reproducible builds). Since the package-lock.json contains agit+ssh://URL, npm tries to clone via SSH, which fails because:GH_TOKENor SSH key that npm can use for git+ssh:// authenticationFailed Jobs and Errors
All three jobs failed at the npm installation step with the same root cause:
Recommended Actions
Immediate Fix
Regenerate
package-lock.jsonwith HTTPS URLs instead of SSH:Alternative Solutions
Use a specific npm package version instead of the GitHub shorthand:
However, this might not work as
@actions/github-scriptmay not be published to npm.Use HTTPS URL directly:
Configure CI to use HTTPS (if we want to keep the current approach):
Add a step before npm ci:
Prevention Strategies
Always configure git to use HTTPS before generating package-lock.json when working with GitHub dependencies specified as
github:org/repo.Add to development documentation:
Consider CI pre-commit checks: Add a check to verify package-lock.json doesn't contain
git+ssh://URLs:Use explicit HTTPS URLs in package.json for GitHub dependencies instead of the shorthand:
AI Team Self-Improvement
Add to
.github/agents/developer.instructions.mdorAGENTS.md: