Skip to content
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ contributors_file*
##documentation
scripts/sort_contibutors/.env
scripts/sort_contibutors/contributors_file.*
scripts/sort_contibutors/.tools/
scripts/sort_contibutors/bin/

#optimizations
.github/scripts/binary_version.txt
Expand Down
8 changes: 4 additions & 4 deletions scripts/sort_contibutors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ vet:
$(GO) vet ./...

security:
@command -v gosec >/dev/null 2>&1 || { \
@if command -v gosec >/dev/null 2>&1; then \
gosec ./...; \
else \
echo "gosec not found. Installing with: go install github.com/securego/gosec/v2/cmd/gosec@latest"; \
GOBIN=$$(pwd)/.tools $(GO) install github.com/securego/gosec/v2/cmd/gosec@latest || exit 1; \
PATH=$$(pwd)/.tools:$$PATH gosec ./...; \
exit $$?; \
}
gosec ./...
fi

clean:
rm -rf $(BUILD_DIR) .tools
2 changes: 2 additions & 0 deletions scripts/sort_contibutors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ var excludedContributors = map[string]struct{}{
"commjoen": {},
"bendehaan": {},
"benno001": {},
"copilot": {},
"copilot-swe-agent": {},
}

var knownNames = map[string]string{
Expand Down
20 changes: 20 additions & 0 deletions scripts/sort_contibutors/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,23 @@ func TestWriteFile(t *testing.T) {
t.Fatalf("unexpected file content: %s", string(b))
}
}

func TestParseContributorListExcludesAutomatedAccounts(t *testing.T) {
t.Parallel()

a := &app{nameCache: map[string]string{}}
input := []contributorAPI{
{Login: "some[bot]", Contributions: 10},
{Login: "copilot", Contributions: 10},
{Login: "copilot-swe-agent", Contributions: 10},
{Login: "f3rn0s", Contributions: 5},
}

got := a.parseContributorList(input)
if len(got) != 1 {
t.Fatalf("expected 1 contributor after filtering, got %d", len(got))
}
if got[0].Username != "f3rn0s" {
t.Fatalf("expected f3rn0s to remain, got %+v", got[0])
}
}
Loading