Skip to content

Commit

Permalink
Compare against created, updated, pushed dates to protect repos, refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
rednafi committed Mar 17, 2024
1 parent 362c063 commit c87fbf0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ type repo struct {
Owner struct {
Name string `json:"login"`
} `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PushedAt time.Time `json:"pushed_at"`
}

var httpClientPool = sync.Pool{
Expand Down Expand Up @@ -138,7 +140,8 @@ func filterForkedRepos(
cutOffDate := time.Now().AddDate(0, 0, -olderThanDays)

for _, repo := range forkedRepos {
if repo.UpdatedAt.After(cutOffDate) {
if repo.CreatedAt.After(cutOffDate) ||
repo.UpdatedAt.After(cutOffDate) || repo.PushedAt.After(cutOffDate) {
guardedRepos = append(guardedRepos, repo)
continue
}
Expand Down

0 comments on commit c87fbf0

Please sign in to comment.