Skip to content

Account for replication delay after repository was created #6

Open
@gr2m

Description

@gr2m

We currently add the octoherd-script topic right after we create the repository

let repositoryResponse;
if (isUserRepo) {
repositoryResponse = octokit.request("POST /user/repos", createRepoOptions);
} else {
repositoryResponse = octokit.request("POST /orgs/{org}/repos", {
org: owner,
...createRepoOptions,
});
}
// add topic
await octokit.request("PUT /repos/{owner}/{repo}/topics", {
mediaType: {
previews: ["mercy"],
},
owner,
repo,
names: ["octoherd-script"],
});

That can result in a 404 due to the replication lag in GitHub's databases.

We should add an explicit retry to the request which adds the topic. For that we need to use Octokit's retry plugin, then we need to add { request: { retries: 3, retryAfter: 1 } } to the request options. The replication lag should never be longer than 3 seconds.

As we need the retry plugin, we could as well replace @octokit/core with @octoherd/octokit which already has the retry request loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions