( octokit: ProbotOctokit, log: Logger, jobData: SchedulerJobData, )
| 76 | } |
| 77 | |
| 78 | export async function getPullConfig( |
| 79 | octokit: ProbotOctokit, |
| 80 | log: Logger, |
| 81 | jobData: SchedulerJobData, |
| 82 | ): Promise<PullConfig | null> { |
| 83 | log.info(`⚙️ Fetching config`); |
| 84 | |
| 85 | const { owner, repo } = jobData; |
| 86 | |
| 87 | const { data: repository } = await octokit.rest.repos.get({ owner, repo }); |
| 88 | |
| 89 | if (repository.archived) { |
| 90 | log.debug(`⚠️ Repository is archived, skipping`); |
| 91 | return null; // TODO Cancel scheduled job |
| 92 | } |
| 93 | |
| 94 | let config = await getLivePullConfig(octokit, log, jobData); |
| 95 | if (!config && !repository.fork) { |
| 96 | return null; // TODO Cancel scheduled job |
| 97 | } else if (!config) { |
| 98 | config = getDefaultPullConfig(repository, log); |
| 99 | } |
| 100 | |
| 101 | return config; |
| 102 | } |
no test coverage detected