Unverified Commit 05d13d45 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Drain the maintainer auto-close queue in one run (#100733)

> [!TIP]
> Best reviewed by hide whitespace:
[files?w=1](https://github.com/vercel/next.js/pull/100733/files?w=1).

Previously, were checking to close issue 1 per hour. Now that check
closes all availables at once. Currently maxed to 5 from agent side.
parent 68406a4c
async function deliverOneVerifiedClose({ core, github }) { async function deliverVerifiedCloses({ core, github }) {
const queue = const queue =
'https://next-maintainer-agent.vercel.tools/eve/agents/close-verifier/eve/v1/auto-close' 'https://next-maintainer-agent.vercel.tools/eve/agents/close-verifier/eve/v1/auto-close'
const repository = 'vercel/next.js' const repository = 'vercel/next.js'
...@@ -58,9 +58,7 @@ async function deliverOneVerifiedClose({ core, github }) { ...@@ -58,9 +58,7 @@ async function deliverOneVerifiedClose({ core, github }) {
} }
} }
const claimed = await queueRequest('/claim') async function deliver(claim) {
if (claimed === null) return
const claim = claimed
const marker = `<!-- next-maintainer-auto-close:${claim.approvalId} -->` const marker = `<!-- next-maintainer-auto-close:${claim.approvalId} -->`
try { try {
...@@ -94,7 +92,10 @@ async function deliverOneVerifiedClose({ core, github }) { ...@@ -94,7 +92,10 @@ async function deliverOneVerifiedClose({ core, github }) {
} }
if (markerComment !== undefined) { if (markerComment !== undefined) {
// This is either a partial prior run or a human reopen. Leave it open. // This is either a partial prior run or a human reopen. Leave it open.
await reportStale(claim, 'Issue is open after a prior delivery comment.') await reportStale(
claim,
'Issue is open after a prior delivery comment.'
)
return return
} }
...@@ -150,6 +151,16 @@ async function deliverOneVerifiedClose({ core, github }) { ...@@ -150,6 +151,16 @@ async function deliverOneVerifiedClose({ core, github }) {
} }
throw error throw error
} }
}
// The queue releases each cycle's verified closes together and enforces the
// daily limit, so take claims until it has nothing left. A failed close
// stops the run after reporting a retry.
for (;;) {
const claim = await queueRequest('/claim')
if (claim === null) return
await deliver(claim)
}
} }
module.exports = { deliverOneVerifiedClose } module.exports = { deliverVerifiedCloses }
...@@ -29,10 +29,10 @@ jobs: ...@@ -29,10 +29,10 @@ jobs:
sparse-checkout: .github/scripts/next-maintainer-auto-close.js sparse-checkout: .github/scripts/next-maintainer-auto-close.js
sparse-checkout-cone-mode: false sparse-checkout-cone-mode: false
- name: Pull and deliver one verified close - name: Pull and deliver every released close
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
const { deliverOneVerifiedClose } = require('./.github/scripts/next-maintainer-auto-close.js') const { deliverVerifiedCloses } = require('./.github/scripts/next-maintainer-auto-close.js')
await deliverOneVerifiedClose({ core, github }) await deliverVerifiedCloses({ core, github })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment