Skip to content

Commit

Permalink
Fix "unknown package manager" error (#1377)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyskoedijk authored Oct 1, 2024
1 parent f7c491c commit 93eac02
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions extension/tasks/dependabotV2/utils/dependabot/parseConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,40 @@ function parseUpdates(config: any): IDependabotUpdate[] {
throw new Error("The value 'package-ecosystem' in dependency update config is missing");
}

// Remap the package ecyosystem name from config to a value that dependabot-core/cli understands.
// Config values: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
// Core/CLI values: https://github.com/dependabot/dependabot-core/blob/main/common/lib/dependabot/config/file.rb
dependabotUpdate['package-ecosystem'] = (() => {
const ecosystem = dependabotUpdate['package-ecosystem'].toLowerCase();
switch (ecosystem) {
case 'devcontainer':
return 'devcontainers';
case 'github-actions':
return 'github_actions';
case 'gitsubmodule':
return 'submodules';
case 'gomod':
return 'go_modules';
case 'mix':
return 'hex';
case 'npm':
return 'npm_and_yarn';
// Additional aliases, for convenience
case 'pipenv':
return 'pip';
case 'pip-compile':
return 'pip';
case 'poetry':
return 'pip';
case 'pnpm':
return 'npm_and_yarn';
case 'yarn':
return 'npm_and_yarn';
default:
return ecosystem;
}
})();

// zero is a valid value
if (!dependabotUpdate['open-pull-requests-limit'] && dependabotUpdate['open-pull-requests-limit'] !== 0) {
dependabotUpdate['open-pull-requests-limit'] = 5;
Expand Down

0 comments on commit 93eac02

Please sign in to comment.