Skip to content

Commit

Permalink
chore: Remove archived and inactive repos
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 29, 2024
1 parent 0db0da0 commit 57502bd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 53 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.metals/
.backup/
.bsp/
.scala-build/
34 changes: 0 additions & 34 deletions repos-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
- asachdeva/fpinsscala
- asachdeva/zio_launch
- atnos-org/eff
- atnos-org/origami
- Atry/fastring
- Atry/FutureBinding.scala
- Atry/JsPromiseBinding.scala
Expand Down Expand Up @@ -112,9 +111,6 @@
- bitlap/zim
- bitmarck-service/base32check-java
- bitmarck-service/base32check-scala
- bitrockteam/kafka-dvs-api
- bitrockteam/kafka-dvs-aviation-edge-producer
- bitrockteam/kafka-dvs-streams
- bkirwi/decline
- blackdoor/jose
- blemale/scaffeine
Expand Down Expand Up @@ -204,7 +200,6 @@
- coursier/coursier-channel.g8
- coursier/dependency
- coursier/echo
- coursier/http-server
- coursier/interface
- coursier/jni-utils
- coursier/publish
Expand Down Expand Up @@ -386,7 +381,6 @@
- guardrail-dev/guardrail-maven-plugin
- guardrail-dev/guardrail-sample-gradle-springmvc
- guardrail-dev/guardrail-sample-http4s
- guardrail-dev/guardrail-sample-maven-dropwizard
- guardrail-dev/guardrail-sample-sbt-akkahttp
- guardrail-dev/sbt-guardrail
- gumdrop/quizleague
Expand Down Expand Up @@ -432,13 +426,9 @@
- jamesward/zio-mavencentral
- janstenpickle/graal-kafka-client
- janstenpickle/hotswap-ref
- japgolly/clear-config
- japgolly/microlibs-scala
- japgolly/nyaya
- japgolly/scalajs-react
- japgolly/scala-graal
- japgolly/test-state
- japgolly/univeq
- jatcwang/difflicious
- jatcwang/scalafix-named-params
- jchapuis/fs2-kafka-mock
Expand All @@ -461,14 +451,12 @@
- johnynek/bosatsu
- jpbnetley/Mongo-csv-importer
- justapagamentos/playframework-core
- justinhj/fp-starter-pack.g8
- jwojnowski/fs2-aes
- jwojnowski/humanoid
- jwojnowski/oidc4s
- jwojnowski/scuid
- jwt-scala/jwt-scala
- jxnu-liguobin/scala-macro-tools
- kailuowang/henkan
- kailuowang/mau
- kailuowang/sbt-catalysts
- kaizen-solutions/virgil
Expand All @@ -485,7 +473,6 @@
- KelkooGroup/theGardener
- keuhdall/otel4s-grafana-example
- Khalian/Modulo12
- kiendang/sbt-scalapy
- kierendavies/mill-explicit-deps
- kierendavies/skunk-migrate
- kinoplan/scalajs-react-material-ui
Expand All @@ -498,7 +485,6 @@
- kmizu/jsonda
- kmizu/matlike
- kontainers/PureCSV
- kostjas/spark-google-spreadsheets
- kovstas/fs2-throttler
- kovszilard/twitter-server-prometheus
- kubukoz/smithy-playground
Expand Down Expand Up @@ -575,7 +561,6 @@
- lucproglangcourse/primenumbers-http4s-scala
- m2-oss/calypso
- macro-peg/macro_peg
- majk-p/identicon4s
- makiftutuncu/e
- manocha-aman/wind-alerts
- mariohuizar/stream-detector:develop
Expand Down Expand Up @@ -618,7 +603,6 @@
- msgpack/msgpack-java
- mukhtar1227ali/Poker_2
- mvillafuertem/scala
- mvillafuertem/scalajs-react-world
- mvillafuertem/scalcite
- nachinius/fp-scala-template
- nachinius/starter.g8
Expand Down Expand Up @@ -651,12 +635,10 @@
- nigeleke/flac4s:develop
- nigeleke/life:develop
- nigeleke/ohmic:develop
- nigeleke/sbt-rust:develop
- nigeleke/scala-seed.g8
- nikitaDanilenko/foodie
- niklasf/lila-openingexplorer
- nikolaiser/biser
- niqdev/scala-fp
- nivanov/cosplay
- nixiesearch/nixiesearch
- nMoncho/helenus
Expand All @@ -666,7 +648,6 @@
- note/dhallj-magnolia
- novakov-alexey/http4s-spnego
- novakov-alexey/krb-operator2
- nrinaudo/kantan.csv
- nrktkt/ninny-json
- nryanov/consul4s
- NthPortal/extra-predef
Expand Down Expand Up @@ -700,7 +681,6 @@
- phelps-sg/play-hmac-signatures
- phenoscape/owlery
- phenoscape/owlet
- phenoscape/phenoscape-kb-services
- phenoscape/phenoscape-kb-web-ui
- Philippus/akka-http-testkit-munit
- Philippus/baggage-jwt
Expand All @@ -724,7 +704,6 @@
- Philippus/zio-pekko-cluster:series/1.x
- pityka/lamp
- pityka/nspl
- pityka/pairwisealignment
- pityka/saddle
- pityka/selfpackage
- pityka/tasks
Expand Down Expand Up @@ -797,14 +776,12 @@
- plokhotnyuk/rtree2d
- pme123/camundala
- polyvariant/better-tostring
- polyvariant/colorize-scala
- polyvariant/sttp-oauth2
- ppurang/abctemplates
- ppurang/asynch
- precog/fs2-ssh
- precog/sbt-precog
- profunktor/fs2-rabbit
- prom3th3us/zio-actors-cassandra-journal
- proteinevolution/Toolkit
- pstutz/syncodia
- pureconfig/pureconfig
Expand Down Expand Up @@ -861,7 +838,6 @@
- sangria-graphql/sangria-circe
- sangria-graphql/sangria-federated
- sangria-graphql/sangria-ion
- sangria-graphql/sangria-jackson
- sangria-graphql/sangria-json4s-jackson
- sangria-graphql/sangria-json4s-native
- sangria-graphql/sangria-marshalling-api
Expand Down Expand Up @@ -889,7 +865,6 @@
- sbt/sbt-gzip
- sbt/sbt-header
- sbt/sbt-jacoco
- sbt/sbt-java-formatter
- sbt/sbt-jni
- sbt/sbt-jshint
- sbt/sbt-js-engine
Expand Down Expand Up @@ -919,7 +894,6 @@
- ScalaConsultants/zio-quickstart.g8
- ScalaConsultants/zio-slick-interop
- scalalandio/chimney
- scalapb/common-protos
- scalapb/protobuf-scala-runtime
- scalapb/protoc-bridge
- scalapb/ScalaPB
Expand Down Expand Up @@ -985,7 +959,6 @@
- senia-psm/zio-test-akka-http
- sentenza/cats-http4s-crypto
- sentenza/hacktoberfest-scala-algorithms
- sentenza/PureCSV
- SethTisue/adventofcode
- SethTisue/Project-Euler
- shadaj/scalapy
Expand Down Expand Up @@ -1033,7 +1006,6 @@
- stryker-mutator/stryker4s
- stryker-mutator/weapon-regex
- StuartApp/zcaffeine
- sullis/java-scala-interop-examples
- sullis/jms-testkit
- sullis/scala-hello-world-app
- suzaku-io/boopickle
Expand Down Expand Up @@ -1061,9 +1033,6 @@
- takapi327/ldbc
- tanishiking/semanticdb-for-scala3
- teamclairvoyant/restonomer:staging
- TeamWanari/sbt-paradox-diagrams
- TeamWanari/tutelar
- tegonal/workflow-helper
- tersesystems/blindsight
- testcontainers/testcontainers-scala
- tethys-json/tethys
Expand Down Expand Up @@ -1097,8 +1066,6 @@
- tkrs/orcus
- tminglei/slick-pg
- TobiasRoland/scala-xml-encoder
- topl/bifrost:dev
- topl/BramblSc:main
- ToToTec/CmdOption
- tototoshi/slick-joda-mapper
- tpolecat/doobie
Expand Down Expand Up @@ -1197,7 +1164,6 @@
- weso/shacl-s
- weso/shex-s
- weso/srdf
- weso/utils
- windymelt/ak4-lambda
- windymelt/cdp-scala
- windymelt/zmm
Expand Down
75 changes: 56 additions & 19 deletions scripts/test-repos.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using dep org.kohsuke:github-api:1.324
//> using dep org.kohsuke:github-api:1.326
//> using dep com.lihaoyi::pprint::0.9.0
//> using dep ch.epfl.lamp::gears::0.2.0
//> using dep com.outr::scribe::3.15.0
Expand Down Expand Up @@ -27,6 +27,7 @@ import org.kohsuke.github.GHException
import org.kohsuke.github.HttpException
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.nio.file.StandardOpenOption

val inactiveYears = 2
val inactiveDateCutoff =
Expand All @@ -38,6 +39,10 @@ val lastMonth =
val date = LocalDate.now().minusDays(30)
">" + date.format(DateTimeFormatter.ISO_LOCAL_DATE)

val today =
val date = LocalDate.now()
date.format(DateTimeFormatter.ISO_LOCAL_DATE)

val renamedMessage =
"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them."

Expand All @@ -46,20 +51,24 @@ case class RepoEntry(repo: String, branch: Option[String]):
case RepoEntry(repo, Some(branch)) => s"$repo:$branch"
case RepoEntry(repo, None) => repo

enum RepoResult(repo: String, branch: Option[String], val isValid: Boolean):
case Invalid(repo: String, branch: Option[String])
enum RepoResult(
val repo: String,
val branch: Option[String],
val isValid: Boolean
):
case Invalid(override val repo: String, override val branch: Option[String])
extends RepoResult(repo, branch, isValid = false)
case Archived(repo: String)
case Archived(override val repo: String)
extends RepoResult(repo, branch = None, isValid = false)
case Correct(entry: RepoEntry)
extends RepoResult(entry.repo, entry.branch, isValid = true)
case Inactive(repo: String)
case Inactive(override val repo: String)
extends RepoResult(repo, branch = None, isValid = false)
case Stale(repo: String)
case Stale(override val repo: String)
extends RepoResult(repo, branch = None, isValid = false)
case Renamed(repo: String)
case Renamed(override val repo: String)
extends RepoResult(repo, branch = None, isValid = false)
case Failure(repo: String, exception: Throwable)
case Failure(override val repo: String, exception: Throwable)
extends RepoResult(repo, branch = None, isValid = false)

override def toString(): String =
Expand All @@ -84,6 +93,16 @@ def main(
githubToken: String
) =
val reposGihub = os.pwd / "repos-github.md"

val alreadyCheckedPath = os.pwd / ".backup" / (today + ".txt")
val alreadyChecked =
if (os.exists(alreadyCheckedPath))
os.read(alreadyCheckedPath).linesIterator.map(_.split(" ").head).toSet
else Set()
val gh = new GitHubBuilder()
.withOAuthToken(githubToken)
.build()

val repos = os
.read(reposGihub)
.split("\n")
Expand All @@ -95,9 +114,11 @@ def main(
case _ => None

}
val gh = new GitHubBuilder()
.withOAuthToken(githubToken)
.build()
.filter {
case RepoEntry(repo, None) => !alreadyChecked.contains(repo)
case RepoEntry(repo, Some(branch)) =>
!alreadyChecked.contains(repo + ":" + branch)
}

def wrongBranch(ghRepo: GHRepository, repoEntry: RepoEntry) =
repoEntry match
Expand Down Expand Up @@ -136,7 +157,7 @@ def main(
else Some(RepoResult.Stale(repoEntry.repo))

Async.blocking:
val nonExistent = repos
val allRepoResults = repos
.grouped(5)
.flatMap { repos =>
repos.map { repoEntry =>
Expand All @@ -149,17 +170,17 @@ def main(
wrongBranch(ghRepo, repoEntry)
.orElse(archived(ghRepo, repoEntry))
.orElse(isInactive(ghRepo, repoEntry))
.orElse(noScalaStewardActivity(ghRepo, repoEntry))
// .orElse(noScalaStewardActivity(ghRepo, repoEntry))
.getOrElse(RepoResult.Correct(repoEntry))
case _ => RepoResult.Correct(repoEntry)

Retry.untilSuccess
.withMaximumFailures(5)
.withDelay(
Delay.backoff(
maximum = 5.minutes,
maximum = 2.minutes,
starting = 10.seconds,
multiplier = 4,
multiplier = 2,
jitter = Jitter.equal
)
) {
Expand All @@ -185,10 +206,26 @@ def main(
}
}
}
.filter(!_.isValid)
.toList

if nonExistent.nonEmpty then
println(s"\nIdentified problems with ${nonExistent.length} repositories:")
nonExistent.foreach: repo =>
val backup = allRepoResults
.map { repoResult =>
repoResult.repo + repoResult.branch.mkString(
":",
"",
""
) + s" https://github.com/$repoResult"
}
.mkString("\n")
os.write.append(
alreadyCheckedPath,
backup,
createFolders = true
)
val identifiedProblems =
allRepoResults.filter(!_.isValid)

if identifiedProblems.nonEmpty then
println(s"\nIdentified problems with ${identifiedProblems.length} repositories:")
identifiedProblems.foreach: repo =>
println(s" - https://github.com/$repo")

0 comments on commit 57502bd

Please sign in to comment.