1+ /*
2+ * Copyright 2026 Google LLC
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ export default async function autoAssign ( { github, context } ) {
18+ console . log ( 'A2UI Issue Auto-assignment script started' ) ;
19+
20+ let issueNumber ;
21+ let activeAssigneesList ;
22+
23+ // Hardcoded assignee lists
24+ const issueAssigneesList = [ 'selamw1' ] ;
25+
26+ // Determine event type
27+ if ( context . payload . issue ) {
28+ issueNumber = context . payload . issue . number ;
29+ activeAssigneesList = issueAssigneesList ;
30+ console . log ( 'Event Type: Issue' ) ;
31+ } else {
32+ console . log ( 'Not an Issue event. Exiting.' ) ;
33+ return ;
34+ }
35+
36+ console . log ( 'Target assignees list:' , activeAssigneesList ) ;
37+
38+ if ( ! activeAssigneesList || activeAssigneesList . length === 0 ) {
39+ console . log ( 'No assignees configured for this type.' ) ;
40+ return ;
41+ }
42+
43+ // Round-robin assignment
44+ const selection = issueNumber % activeAssigneesList . length ;
45+ const assigneeToAssign = activeAssigneesList [ selection ] ;
46+
47+ console . log ( `Assigning #${ issueNumber } to: ${ assigneeToAssign } ` ) ;
48+
49+ try {
50+ await github . rest . issues . addAssignees ( {
51+ issue_number : issueNumber ,
52+ owner : context . repo . owner ,
53+ repo : context . repo . repo ,
54+ assignees : [ assigneeToAssign ] ,
55+ } ) ;
56+ console . log ( 'Assignment successful' ) ;
57+ } catch ( error ) {
58+ console . log ( 'Failed to assign:' , error . message ) ;
59+ }
60+
61+ console . log ( 'A2UI Issue Auto-assignment script completed' ) ;
62+ }
0 commit comments