Fix stale in_review self-healing to run in JSON mode and update local objects before state load
This commit is contained in:
parent
a682539db3
commit
99f5a378f1
|
|
@ -60,11 +60,11 @@ export async function action(opts: { json?: boolean }) {
|
||||||
const statuses = Object.fromEntries(statusEntries)
|
const statuses = Object.fromEntries(statusEntries)
|
||||||
|
|
||||||
// Batch self-heal stale in_review flags with a single state write
|
// Batch self-heal stale in_review flags with a single state write
|
||||||
if (staleReviewSessions.length > 0 && !opts.json) {
|
if (staleReviewSessions.length > 0) {
|
||||||
|
for (const s of staleReviewSessions) s.in_review = false
|
||||||
const current = await state.load(root).catch(() => null)
|
const current = await state.load(root).catch(() => null)
|
||||||
if (current) {
|
if (current) {
|
||||||
for (const s of staleReviewSessions) {
|
for (const s of staleReviewSessions) {
|
||||||
s.in_review = false
|
|
||||||
if (current.sessions[s.branch]) current.sessions[s.branch].in_review = false
|
if (current.sessions[s.branch]) current.sessions[s.branch].in_review = false
|
||||||
}
|
}
|
||||||
await state.save(root, current).catch(() => {})
|
await state.save(root, current).catch(() => {})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user