@@ -18,19 +18,39 @@ jobs:
1818 permissions :
1919 issues : write
2020 pull-requests : read
21+ env :
22+ AUTO_ASSIGN_PR_POOL : ${{ vars.AUTO_ASSIGN_PR_POOL }}
23+ AUTO_ASSIGN_PR_SKIP : ${{ vars.AUTO_ASSIGN_PR_SKIP }}
2124
2225 steps :
2326 - name : Calculate Workload and Apply
2427 uses : actions/github-script@v7
2528 with :
2629 script : |
27- // Keep the candidate pool centralized in one place so every PR uses the same ranking.
28- const pool = ['cheenamalhotra', 'paulmedynski', 'priyankatiwari08', 'benrr101', 'mdaigle', 'apoorvdeshmukh'];
2930 const owner = context.repo.owner;
3031 const repo = context.repo.repo;
3132 const prNumber = context.issue.number;
3233 const author = context.payload.pull_request.user.login;
3334 const normalizeLogin = login => login.toLowerCase();
35+ const parseCsvLogins = value => (value ?? '')
36+ .split(',')
37+ .map(entry => entry.trim())
38+ .filter(entry => entry.length > 0);
39+
40+ // Fallback pool keeps behavior unchanged when no repo variable is configured.
41+ const defaultPool = ['cheenamalhotra', 'paulmedynski', 'priyankatiwari08', 'benrr101', 'mdaigle', 'apoorvdeshmukh'];
42+ const configuredPool = parseCsvLogins(process.env.AUTO_ASSIGN_PR_POOL);
43+ const rawPool = configuredPool.length > 0 ? configuredPool : defaultPool;
44+ const skipUsers = new Set(parseCsvLogins(process.env.AUTO_ASSIGN_PR_SKIP).map(normalizeLogin));
45+ const seenPoolUsers = new Set();
46+ const pool = [];
47+ for (const user of rawPool) {
48+ const lower = normalizeLogin(user);
49+ if (!seenPoolUsers.has(lower)) {
50+ seenPoolUsers.add(lower);
51+ pool.push(user);
52+ }
53+ }
3454
3555 let latestPr;
3656 try {
6484
6585 const candidates = pool.filter(user =>
6686 normalizeLogin(user) !== normalizeLogin(author) &&
87+ !skipUsers.has(normalizeLogin(user)) &&
6788 !currentAssignees.some(a => normalizeLogin(a) === normalizeLogin(user))
6889 );
6990
0 commit comments