Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/scripts/__tests__/token-load-balancer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@ test('getBestAvailableToken: handles tokens with zero remaining', () => {
assert.equal(best.id, 'ONE');
});

test('getOptimalToken: reserves Maint 71 cross-repo PR writes for the owner PAT', async () => {
seedRegistry([
{ id: 'SERVICE_BOT_PAT', remaining: 4999 },
{ id: 'OWNER_PR_PAT', remaining: 3000 },
]);
balancer.tokenRegistry.lastRefresh = Date.now();

const selection = await balancer.getOptimalToken({
github: {},
core: {},
capabilities: ['pull-requests:write'],
task: 'maint-71-merge-sync-prs',
});

assert.equal(selection.source, 'OWNER_PR_PAT');
assert.equal(selection.exclusive, true);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

// ---------------------------------------------------------------------------
// hasHealthyTokens
// ---------------------------------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion .github/scripts/token_load_balancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ const TOKEN_SPECIALIZATIONS = {
description: 'Workflow dispatch triggers and belt conveyor operations',
},
OWNER_PR_PAT: {
primaryTasks: ['pr-creation-as-owner', 'cross-repo-sync', 'dependabot-automerge', 'label-sync'],
primaryTasks: [
'pr-creation-as-owner',
'cross-repo-sync',
'dependabot-automerge',
'label-sync',
'maint-71-merge-sync-prs',
Comment thread
stranske marked this conversation as resolved.
Outdated
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
],
exclusive: true,
description: 'Owner PAT for PR creation and owner-scoped cross-repo operations',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ const TOKEN_SPECIALIZATIONS = {
description: 'Workflow dispatch triggers and belt conveyor operations',
},
OWNER_PR_PAT: {
primaryTasks: ['pr-creation-as-owner', 'cross-repo-sync', 'dependabot-automerge', 'label-sync'],
primaryTasks: [
'pr-creation-as-owner',
'cross-repo-sync',
'dependabot-automerge',
'label-sync',
'maint-71-merge-sync-prs',
],
exclusive: true,
description: 'Owner PAT for PR creation and owner-scoped cross-repo operations',
},
Expand Down