Skip to content

Commit 2b816c4

Browse files
authored
Merge pull request #2502 from OWASP/copilot/fix-breaking-action-run
Fix Sort Contributors CI failure and exclude Copilot accounts from generated contributor lists
2 parents 7f4cd71 + ad08d31 commit 2b816c4

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ contributors_file*
107107
##documentation
108108
scripts/sort_contibutors/.env
109109
scripts/sort_contibutors/contributors_file.*
110+
scripts/sort_contibutors/.tools/
111+
scripts/sort_contibutors/bin/
110112

111113
#optimizations
112114
.github/scripts/binary_version.txt

scripts/sort_contibutors/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ vet:
2525
$(GO) vet ./...
2626

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

3636
clean:
3737
rm -rf $(BUILD_DIR) .tools

scripts/sort_contibutors/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ var excludedContributors = map[string]struct{}{
6767
"commjoen": {},
6868
"bendehaan": {},
6969
"benno001": {},
70+
"copilot": {},
71+
"copilot-swe-agent": {},
7072
}
7173

7274
var knownNames = map[string]string{

scripts/sort_contibutors/main_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,23 @@ func TestWriteFile(t *testing.T) {
147147
t.Fatalf("unexpected file content: %s", string(b))
148148
}
149149
}
150+
151+
func TestParseContributorListExcludesAutomatedAccounts(t *testing.T) {
152+
t.Parallel()
153+
154+
a := &app{nameCache: map[string]string{}}
155+
input := []contributorAPI{
156+
{Login: "some[bot]", Contributions: 10},
157+
{Login: "copilot", Contributions: 10},
158+
{Login: "copilot-swe-agent", Contributions: 10},
159+
{Login: "f3rn0s", Contributions: 5},
160+
}
161+
162+
got := a.parseContributorList(input)
163+
if len(got) != 1 {
164+
t.Fatalf("expected 1 contributor after filtering, got %d", len(got))
165+
}
166+
if got[0].Username != "f3rn0s" {
167+
t.Fatalf("expected f3rn0s to remain, got %+v", got[0])
168+
}
169+
}

0 commit comments

Comments
 (0)