Merge branch 'main' into repo-sync
This commit is contained in:
@@ -29,6 +29,7 @@ if (!process.env.REPO) {
|
||||
const octokit = getOctokit()
|
||||
|
||||
const protectedEnvNames = ['production']
|
||||
const maxEnvironmentsToProcess = 50
|
||||
|
||||
// How long must a PR be closed without being merged to be considered stale?
|
||||
const ONE_HOUR = 60 * 60 * 1000
|
||||
@@ -48,6 +49,7 @@ async function main() {
|
||||
const prInfoMatch = /^(?:gha-|ghd-)?(?<repo>docs(?:-internal)?)-(?<pullNumber>\d+)--.*$/
|
||||
const legacyPrInfoMatch = /^help-docs-pr-(?<pullNumber>\d+)$/
|
||||
|
||||
let exceededLimit = false
|
||||
let matchingCount = 0
|
||||
let staleCount = 0
|
||||
let spammyCount = 0
|
||||
@@ -81,7 +83,6 @@ async function main() {
|
||||
const envsWithPullIds = envsPlusPullIds.filter(
|
||||
(eppi) => eppi.repo === repo && eppi.pullNumber > 0
|
||||
)
|
||||
matchingCount += envsWithPullIds.length
|
||||
|
||||
nonMatchingEnvNames.push(
|
||||
...envsPlusPullIds
|
||||
@@ -99,6 +100,20 @@ async function main() {
|
||||
if (isSpammy || isStale) {
|
||||
await deleteEnvironment(ewpi.env.name)
|
||||
}
|
||||
|
||||
matchingCount += 1
|
||||
if (matchingCount >= maxEnvironmentsToProcess) {
|
||||
exceededLimit = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (exceededLimit) {
|
||||
console.log(
|
||||
'🛑',
|
||||
chalk.bgRed(`STOP! Exceeded limit, halting after ${maxEnvironmentsToProcess}.`)
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user