From 2e692651bed2ce291ab410be2c3d087a71ebf292 Mon Sep 17 00:00:00 2001 From: Alexandre Boyer <33391039+ng-galien@users.noreply.github.com> Date: Fri, 30 Sep 2022 02:01:45 +0200 Subject: [PATCH] fix(README): set `installationId` in code example (#350) Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com> --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1910373c7..565168afd 100644 --- a/README.md +++ b/README.md @@ -69,13 +69,16 @@ const app = new App({ const { data } = await app.octokit.request("/app"); console.log("authenticated as %s", data.name); - -for await (const { octokit, repository } of app.eachRepository.iterator()) { - await octokit.request("POST /repos/{owner}/{repo}/dispatches", { - owner: repository.owner.login, - repo: repository.name, - event_type: "my_event", - }); +for await (const { installation } of app.eachInstallation.iterator()) { + for await (const { octokit, repository } of app.eachRepository.iterator({ + installationId: installation.id, + })) { + await octokit.request("POST /repos/{owner}/{repo}/dispatches", { + owner: repository.owner.login, + repo: repository.name, + event_type: "my_event", + }); + } } app.webhooks.on("issues.opened", async ({ octokit, payload }) => {