From 9b4a904d6b8f70169b1b14452a498d26ccdbeef2 Mon Sep 17 00:00:00 2001 From: Tobias Wilken Date: Sun, 30 Nov 2025 07:36:00 +0100 Subject: [PATCH] fix: only fail CI when transfer permissions are missing Normal drift (missing repos, description/topic differences) will be fixed on merge, so CI should not block those. Pending transfers with admin permissions are ready to proceed once transfer automation is implemented. Only block CI when a transfer is requested but worlddriven lacks admin access to the source repository - this requires manual intervention. --- scripts/detect-drift.js | 45 ++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/scripts/detect-drift.js b/scripts/detect-drift.js index ce0439a..ac62be8 100755 --- a/scripts/detect-drift.js +++ b/scripts/detect-drift.js @@ -226,34 +226,43 @@ async function main() { console.log(report); - // Exit with error code if drift detected (useful for CI) - // Note: pendingTransfer blocks CI until transfer automation is implemented + // Check for pending transfers with missing permissions (blocks CI) + const blockedTransfers = drift.pendingTransfer.filter( + r => !drift.transferPermissions.get(r.origin)?.hasPermission + ); + + // Report drift status const hasDrift = drift.missing.length > 0 || drift.extra.length > 0 || drift.descriptionDiff.length > 0 || drift.topicsDiff.length > 0 || drift.pendingTransfer.length > 0; - // Warn about pending transfers (causes CI to fail) - if (drift.pendingTransfer.length > 0) { - console.error('\nāŒ Error: Repository transfer feature is under development'); - console.error(' This PR will be blocked until transfer automation is complete'); - - // Check permission status - const readyCount = drift.pendingTransfer.filter( - r => drift.transferPermissions.get(r.origin)?.hasPermission - ).length; - const blockedCount = drift.pendingTransfer.length - readyCount; - - if (readyCount > 0) { - console.error(` āœ… ${readyCount} repository(ies) ready (admin permission granted)`); + if (hasDrift) { + console.error('\nšŸ“‹ Drift Summary:'); + if (drift.missing.length > 0 || drift.extra.length > 0 || + drift.descriptionDiff.length > 0 || drift.topicsDiff.length > 0) { + console.error(' āœ… Configuration drift will be fixed on merge'); } - if (blockedCount > 0) { - console.error(` āŒ ${blockedCount} repository(ies) blocked (missing admin permission)`); + if (drift.pendingTransfer.length > 0) { + const readyCount = drift.pendingTransfer.length - blockedTransfers.length; + if (readyCount > 0) { + console.error(` āœ… ${readyCount} repository transfer(s) ready (admin permission granted)`); + } + if (blockedTransfers.length > 0) { + console.error(` āŒ ${blockedTransfers.length} repository transfer(s) blocked (missing admin permission)`); + } } } - process.exit(hasDrift ? 1 : 0); + // Only fail CI if there are blocked transfers (missing permissions) + if (blockedTransfers.length > 0) { + console.error('\nāŒ Error: Cannot proceed with repository transfer(s) - missing permissions'); + console.error(' Grant worlddriven admin access to the source repositories to unblock'); + process.exit(1); + } + + process.exit(0); } catch (error) { console.error(`āŒ Error: ${error.message}`); process.exit(1);