async handleClosedIssues()

in functions/src/cron.ts [70:101]


  async handleClosedIssues(
    org: string,
    name: string,
    issueConfig: types.IssueCleanupConfig
  ): Promise<types.Action[]> {
    if (!issueConfig.lock_days) {
      log.debug(`No issue locking config for ${org}/${name}`);
      return [];
    }

    const actions: types.Action[] = [];
    const issues = await this.gh_client.getIssuesForRepo(org, name, "closed");

    for (const issue of issues) {
      const issueActions = await this.handleClosedIssue(
        org,
        name,
        issue,
        issueConfig
      );
      actions.push(...issueActions);

      if (actions.length >= 100) {
        console.warn(
          `Found >100 (${actions.length} issues to perform when checking closed issues for ${org}/${name}, will do the rest tomorrow.`
        );
        return actions;
      }
    }

    return actions;
  }