Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.25']

steps:
- uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}

- name: Build
run: go build -v ./...

- name: Test
run: go test -v -race -coverprofile=coverage.out ./...

- name: Upload coverage
if: matrix.go-version == '1.25'
uses: codecov/codecov-action@v5
with:
files: coverage.out
fail_ci_if_error: false

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'

- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
2 changes: 1 addition & 1 deletion docs/examples/dependabot-cron/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func updateDependency(ctx context.Context, tr *managers.Translator, managerName,
if err := gitCommand(repoPath, "checkout", "-b", branchName); err != nil {
return fmt.Errorf("creating branch: %w", err)
}
defer gitCommand(repoPath, "checkout", "-") // Return to original branch
defer func() { _ = gitCommand(repoPath, "checkout", "-") }() // Return to original branch

// Build and run the update command
cmd, err := tr.BuildCommand(managerName, "update", managers.CommandInput{
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/git-pkgs-integration/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ func ecosystemToManagerWithFallback(ecosystem, detected string) string {
// getGitPkgsOutdated calls git-pkgs outdated --json and parses the output
func getGitPkgsOutdated(repoPath, updateType string) ([]OutdatedPackage, error) {
args := []string{"outdated", "--format", "json"}
if updateType == "patch" {
switch updateType {
case "patch":
// No filter needed, include all
} else if updateType == "minor" {
case "minor":
args = append(args, "--minor") // Skip patch-only
}

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/git-pkgs-integration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func applyUpdate(ctx context.Context, tr *managers.Translator, manager, repoPath

// runCommand executes a command in the specified directory
func runCommand(ctx context.Context, args []string, dir string) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
_, cancel := context.WithTimeout(ctx, 5*time.Minute)
defer cancel()

// In a real implementation, use os/exec
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/git-pkgs/managers

go 1.25.0
go 1.25.6

require gopkg.in/yaml.v3 v3.0.1 // indirect
require gopkg.in/yaml.v3 v3.0.1
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 1 addition & 3 deletions translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ func (t *Translator) buildSingleCommand(binary string, cmd definitions.Command,
}

// Add default flags
for _, flagStr := range cmd.DefaultFlags {
args = append(args, flagStr)
}
args = append(args, cmd.DefaultFlags...)

// Add user-specified flags
for name, val := range input.Flags {
Expand Down