diff --git a/simulator-docker-runner/github.ts b/simulator-docker-runner/github.ts index c76e03735..70164e2d8 100644 --- a/simulator-docker-runner/github.ts +++ b/simulator-docker-runner/github.ts @@ -25,6 +25,8 @@ type FaultTimeout = { type Fault = FaultPanic | FaultTimeout | FaultAssertion; +const MAX_OPEN_SIMULATOR_ISSUES = parseInt(process.env.MAX_OPEN_SIMULATOR_ISSUES || "10", 10); + export class GithubClient { /* This is the git hash of the commit that the simulator was built from. */ GIT_HASH: string; @@ -106,6 +108,12 @@ export class GithubClient { return; } + if (this.openIssueTitles.length >= MAX_OPEN_SIMULATOR_ISSUES) { + console.log(`Max open simulator issues reached: ${MAX_OPEN_SIMULATOR_ISSUES}`); + console.log(`Would create issue in ${this.GITHUB_REPO} with title: ${title} and body: ${body}`); + return; + } + const [owner, repo] = this.GITHUB_REPO.split('/'); const octokit = await this.app!.getInstallationOctokit(this.GITHUB_APP_INSTALLATION_ID);