@@ -12,58 +12,6 @@ import {
1212 getSize ,
1313} from './projects.js'
1414
15- /**
16- * Determines if a PR is authored by Copilot and extracts the human assignee
17- * @param data GraphQL response data containing PR information
18- * @returns Object with isCopilotAuthor boolean and copilotAssignee string
19- */
20- function getCopilotAuthorInfo ( data : Record < string , any > ) : {
21- isCopilotAuthor : boolean
22- copilotAssignee : string
23- } {
24- // Check if this is a Copilot-authored PR
25- const isCopilotAuthor =
26- data . item . __typename === 'PullRequest' &&
27- data . item . author &&
28- data . item . author . login === 'copilot-swe-agent[bot]'
29-
30- // For Copilot PRs, find the appropriate assignee (excluding Copilot itself)
31- let copilotAssignee = ''
32- if ( isCopilotAuthor && data . item . assignees && data . item . assignees . nodes ) {
33- const assignees = data . item . assignees . nodes
34- . map ( ( assignee : Record < string , any > ) => assignee . login )
35- . filter ( ( login : string ) => login !== 'copilot-swe-agent[bot]' )
36-
37- // Use the first non-Copilot assignee
38- copilotAssignee = assignees . length > 0 ? assignees [ 0 ] : ''
39- }
40-
41- return { isCopilotAuthor, copilotAssignee }
42- }
43-
44- /**
45- * Determines the appropriate author field value based on contributor type
46- * @param isCopilotAuthor Whether the PR is authored by Copilot
47- * @param copilotAssignee The human assignee for Copilot PRs (empty string if none)
48- * @param firstTimeContributor Whether this is a first-time contributor
49- * @returns The formatted author field value
50- */
51- function getAuthorFieldValue (
52- isCopilotAuthor : boolean ,
53- copilotAssignee : string ,
54- firstTimeContributor : boolean | undefined ,
55- ) : string {
56- if ( isCopilotAuthor ) {
57- return copilotAssignee ? `Copilot + ${ copilotAssignee } ` : 'Copilot'
58- }
59-
60- if ( firstTimeContributor ) {
61- return ':star: first time contributor'
62- }
63-
64- return process . env . AUTHOR_LOGIN || ''
65- }
66-
6715async function run ( ) {
6816 // Get info about the docs-content review board project
6917 const data : Record < string , any > = await graphql (
@@ -100,14 +48,6 @@ async function run() {
10048 path
10149 }
10250 }
103- author {
104- login
105- }
106- assignees(first: 10) {
107- nodes {
108- login
109- }
110- }
11151 }
11252 }
11353 }
@@ -201,31 +141,17 @@ async function run() {
201141 }
202142 }
203143 const turnaround = process . env . REPO === 'github/docs' ? 3 : 2
204-
205- // Check if this is a Copilot-authored PR and get the human assignee
206- const { isCopilotAuthor, copilotAssignee } = getCopilotAuthorInfo ( data )
207-
208- // Determine the author field value
209- const authorFieldValue = getAuthorFieldValue (
210- isCopilotAuthor ,
211- copilotAssignee ,
212- firstTimeContributor ,
213- )
214-
215144 // Generate a mutation to populate fields for the new project item
216145 const updateProjectV2ItemMutation = generateUpdateProjectV2ItemFieldMutation ( {
217146 item : newItemID ,
218- author : authorFieldValue ,
147+ author : firstTimeContributor ? ':star: first time contributor' : process . env . AUTHOR_LOGIN || '' ,
219148 turnaround,
220149 feature,
221150 } )
222151
223152 // Determine which variable to use for the contributor type
224153 let contributorType
225- if ( isCopilotAuthor ) {
226- // Treat Copilot PRs as Docs team
227- contributorType = docsMemberTypeID
228- } else if ( await isDocsTeamMember ( process . env . AUTHOR_LOGIN || '' ) ) {
154+ if ( await isDocsTeamMember ( process . env . AUTHOR_LOGIN || '' ) ) {
229155 contributorType = docsMemberTypeID
230156 } else if ( await isGitHubOrgMember ( process . env . AUTHOR_LOGIN || '' ) ) {
231157 contributorType = hubberTypeID
@@ -259,8 +185,6 @@ async function run() {
259185 return newItemID
260186}
261187
262- export { run }
263-
264188run ( ) . catch ( ( error ) => {
265189 console . log ( `#ERROR# ${ error } ` )
266190 process . exit ( 1 )
0 commit comments