How to ensure that a repository has been synced to the Github servers?
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 25/100
Piste de recherche
Commencez par les appels RepositoriesService.Create, Get et Edit présentés dans la reproduction, puis comparez leurs réponses d’API avec l’état du dépôt sur github.com. Déterminez si le client expose une vérification fiable de la disponibilité pour activer Advanced Security et Secret Scanning, et documentez le comportement pris en charge ou la limitation lorsque le dépôt est encore en cours de propagation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
The documentation for RepositoriesService.Create states that
Also note that this method will return the response without actually
waiting for GitHub to finish creating the repository and letting the
changes propagate throughout its servers. You may set up a loop with
exponential back-off to verify repository's creation.
However, doing so does not seem to be sufficient to ensure that a new repository has been synced.
I'm trying to create a new repository and enable Github Advanced Security features after it. The Update request returns a 200 and the result also indicates a success (the updated fields contain the value "enabled" which is what I wanted to achieve). When validating the result on github.com the features are disabled.
When I tried to sleep for a couple of seconds after creating and before updating the repo, the result is also visible on github.com.
Here is my code to reproduce the issue:
package main
import (
"context"
"fmt"
"time"
"github.com/google/go-github/v67/github"
log "github.com/sirupsen/logrus"
)
func main() {
org := "some-org"
name := "some-repo"
token := "some-token"
client := github.NewClient(nil).WithAuthToken(token)
_, _, err := client.Repositories.Create(context.Background(), org, &github.Repository{
Name: github.String(name),
AutoInit: github.Bool(true),
Visibility: github.String("internal"),
DefaultBranch: github.String("main"),
})
if err != nil {
log.WithError(err).Fatal("unable to create repository")
}
maxRetries := 5
for i := 0; i < maxRetries; i++ {
_, _, err := client.Repositories.Get(context.Background(), org, name)
if err == nil {
break
}
if i == maxRetries-1 {
log.Fatal("unable to verify repository creation")
}
time.Sleep(time.Duration(i*2) * time.Second)
}
// time.Sleep(5 * time.Second)
repo := github.Repository{
SecurityAndAnalysis: &github.SecurityAndAnalysis{
AdvancedSecurity: &github.AdvancedSecurity{
Status: github.String("enabled"),
},
SecretScanning: &github.SecretScanning{
Status: github.String("enabled"),
},
},
}
updatedRepo, _, err := client.Repositories.Edit(context.Background(), org, name, &repo)
if err != nil {
log.Fatal("unable to enable Advanced Security")
}
fmt.Printf("Advanced Security: %s\n", *updatedRepo.SecurityAndAnalysis.AdvancedSecurity.Status)
fmt.Printf("Secret Scanning: %s\n", *updatedRepo.SecurityAndAnalysis.SecretScanning.Status)
}
No matter if I sleep the 5 seconds or not, both run print
Advanced Security: enabled
Secret Scanning: enabled
github.com without sleeping
github.com with sleeping
Any idea how I can make sure that the repository is ready to enable Advanced Security features? (I'm not sure if other updates are affected as well)
- Langage dominant
- Go
- Étoiles
- 11.3k
- Forks
- 2.5k
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 43
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de google/go-github
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Add actions policies endpointsPeut-être pris @jndz2 l’a pris il y a 7 jours. Ouverte
google/go-github#4583 · 2 commentaires · 1 réaction · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de google/go-github
Issues similaires
-
priority: low 🌱 type: enhancement 💅🏼
Difficulté 2/5 Une demi-journée Accessibilité débutants 84/100
nebari-dev/llm-serving-pack#199 ·
Les mainteneurs répondent en général sous 3 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
area/helm kind/bug priority/backlog triage/accepted
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
lexfrei/cloudflare-tunnel-gateway-controller#889 ·
Les mainteneurs répondent en général sous 1 jour
-
bug difficulty: beginner documentation good first issue help wanted localization
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
wavefnd/wave-platform#140 ·
-
compiler/runtime
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
golang/go#81797 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour