Skip to content

Add pip and golang dependency manifest generation support#2359

Merged
pelikhan merged 6 commits intomainfrom
copilot/add-dependabot-manifest-support
Oct 25, 2025
Merged

Add pip and golang dependency manifest generation support#2359
pelikhan merged 6 commits intomainfrom
copilot/add-dependabot-manifest-support

Conversation

Copy link
Contributor

Copilot AI commented Oct 25, 2025

Add Dependabot Manifest Generation for Python (pip) and Golang

Goal: Extend the existing dependabot manifest generation to support Python (pip) and Golang package ecosystems, similar to the existing npm support.

Status

  • ✅ All builds passing
  • ✅ All tests passing
  • ✅ Lint and format clean
  • ✅ Merging logic verified for all ecosystems

Changes

Fixed build errors (commit 578e95e+):

  • Resolved syntax error in generateDependabotConfig from merge conflict
  • Removed duplicate code that referenced undefined npmUpdate variable
  • Cleaned up orphaned else statement

Improved Go module handling:

  • Changed go.mod generation to skip dependencies without explicit versions
  • Previously used v0.0.0 placeholder which could cause Go module resolution issues
  • Now skips @latest or unversioned dependencies with clear logging
  • Users should use go get package@latest to resolve proper versions

Verified merging behavior for all package systems:

  • dependabot.yml - preserves existing entries (docker, github-actions, etc.) and only adds missing ecosystems
  • package.json - merges new npm dependencies with existing ones
  • requirements.txt - merges new pip packages with existing ones, sorted alphabetically
  • go.mod - preserves module declaration and go version, adds new dependencies

Implementation Summary

Core manifest generation (pkg/workflow/dependabot.go):

  • Added PipDependency and GoDependency types for structured dependency representation
  • Refactored GenerateDependabotManifests to detect and process multiple ecosystems
  • Updated generateDependabotConfig to accept ecosystem map for flexible multi-ecosystem configuration

Python (pip) support:

  • collectPipDependencies / parsePipPackage: Extract packages from pip install / pip3 install commands
  • generateRequirementsTxt: Generate/merge requirements.txt with version specifier support (==, >=, <=, !=, ~=)

Golang support:

  • collectGoDependencies / parseGoPackage: Extract packages from go install / go get commands
  • extractGoFromCommands: Pattern matching for go install/get with version tags
  • generateGoMod: Generate/merge go.mod with module declaration and require blocks

CLI updates (cmd/gh-aw/main.go):

  • Updated --dependabot flag help text to document multi-ecosystem support

Test Results

  • ✅ All new pip-related tests passing
  • ✅ All new golang-related tests passing
  • ✅ All multi-ecosystem integration tests passing
  • ✅ All existing tests still passing
  • ✅ Manual testing verified correct merging behavior
Original prompt

Add dependabot manifest generation add support for

  • python (pip)
  • Golang

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 25, 2025 01:47
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dependabot manifest generation for Python and Golang Add pip and golang dependency manifest generation support Oct 25, 2025
Copilot AI requested a review from pelikhan October 25, 2025 02:00
@pelikhan pelikhan marked this pull request as ready for review October 25, 2025 03:36
Copilot AI review requested due to automatic review settings October 25, 2025 03:36
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

Copy link
Contributor

Copilot AI left a 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 extends the dependabot manifest generation feature to support Python (pip) and Golang ecosystems in addition to the existing npm support, enabling multi-ecosystem dependency management for GitHub Actions workflows.

Key changes:

  • Added structured dependency types for pip and Go packages with version parsing
  • Refactored manifest generation to detect and process multiple ecosystems concurrently
  • Implemented ecosystem-specific manifest generation (requirements.txt and go.mod)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/workflow/dependabot.go Added pip/Go dependency types, refactored GenerateDependabotManifests for multi-ecosystem support, implemented pip/Go package extraction and manifest generation
pkg/workflow/dependabot_test.go Added comprehensive test coverage for pip/Go parsing, collection, manifest generation, and multi-ecosystem scenarios
cmd/gh-aw/main.go Updated CLI help text to document multi-ecosystem support (npm, pip, Go)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +685 to +689
if version == "latest" || version == "" {
// For latest, we need to use a placeholder or skip
// Dependabot will update to actual versions
version = "v0.0.0"
}
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using 'v0.0.0' as a placeholder for 'latest' versions may cause confusion or issues with Go module resolution. Consider documenting this behavior more clearly or investigating if there's a better placeholder convention for go.mod files that Dependabot can work with.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed in commit 2e24fae. Changed the behavior to skip dependencies without explicit versions instead of using v0.0.0 placeholder. Dependencies with @latest or no version are now skipped with a debug log message suggesting users run go get package@latest to resolve proper versions. This avoids Go module resolution issues.

@pelikhan
Copy link
Contributor

/mergefest

@github-actions
Copy link
Contributor

Agentic Mergefest triggered by this issue comment.

@pelikhan
Copy link
Contributor

@copilot fix build, format, lint, fix tests and fix merging existing dependabot setting files for all package systems.

- Fixed syntax error in generateDependabotConfig from merge conflict
- Removed duplicate/orphaned code that referenced non-existent npmUpdate variable
- Improved go.mod generation to skip dependencies without explicit versions instead of using v0.0.0 placeholder
- Added better documentation for version handling in Go modules

All tests passing, build working, lint/format clean.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 25, 2025

@copilot fix build, format, lint, fix tests and fix merging existing dependabot setting files for all package systems.

Fixed in commit 2e24fae:

Build - Resolved syntax error from merge conflict in generateDependabotConfig
Format - No formatting issues
Lint - All checks passing
Tests - All unit tests passing
Merging - Verified merge behavior for all package systems:

  • dependabot.yml preserves existing entries (docker, github-actions, etc.)
  • package.json merges npm dependencies
  • requirements.txt merges pip packages
  • go.mod preserves module declaration and merges dependencies

Also improved go.mod generation to skip dependencies without explicit versions instead of using potentially problematic v0.0.0 placeholder.

Copilot AI requested a review from pelikhan October 25, 2025 03:55
@pelikhan pelikhan merged commit c86e514 into main Oct 25, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-dependabot-manifest-support branch October 25, 2025 04:06
github-actions bot added a commit that referenced this pull request Oct 25, 2025
Update CLI documentation to reflect recent feature additions:

- Document firewall log parsing in --parse flag (PR #2349, #2350)
  - Logs and audit commands now generate firewall.md files
  - JSON output includes firewall analysis

- Update --dependabot documentation (PR #2359)
  - Added pip and Go ecosystem support
  - Clarified command detection patterns

- Add repository feature validation section (PR #2347)
  - Compile validates discussions/issues enabled
  - Prevents runtime failures for incompatible workflows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants