1
0

Search gists on user profile with title, visibility, language & topics (#422)

هذا الالتزام موجود في:
Thomas Miceli
2025-02-02 18:14:03 +01:00
ملتزم من قبل GitHub
الأصل 76fc129c09
التزام 7aa8f84eff
23 ملفات معدلة مع 429 إضافات و54 حذوفات

عرض الملف

@@ -23,6 +23,7 @@ const (
SyncGistPreviews
ResetHooks
IndexGists
SyncGistLanguages
)
var (
@@ -73,6 +74,8 @@ func Run(actionType int) {
functionToRun = resetHooks
case IndexGists:
functionToRun = indexGists
case SyncGistLanguages:
functionToRun = syncGistLanguages
default:
log.Error().Msg("Unknown action type")
}
@@ -166,3 +169,17 @@ func indexGists() {
}
}
}
func syncGistLanguages() {
log.Info().Msg("Syncing all Gist languages...")
gists, err := db.GetAllGistsRows()
if err != nil {
log.Error().Err(err).Msg("Cannot get gists")
return
}
for _, gist := range gists {
log.Info().Msgf("Syncing languages for gist %d", gist.ID)
gist.UpdateLanguages()
}
}