21
21
steps :
22
22
- name : Check if actor is authorized
23
23
id : check_auth
24
- uses : actions/github-script@v6
24
+ uses : actions/github-script@v7
25
25
with :
26
26
github-token : ${{ secrets.GITHUB_TOKEN }}
27
27
script : |
65
65
66
66
- name : Assign GitHub Copilot
67
67
if : ${{ steps.check_auth.outputs.result == 'true' }}
68
- uses : actions/github-script@v6
68
+ uses : actions/github-script@v7
69
69
with :
70
70
github-token : ${{ secrets.GITHUB_TOKEN }}
71
71
script : |
@@ -81,14 +81,18 @@ jobs:
81
81
for (const username of possibleCopilotUsers) {
82
82
try {
83
83
// Check if user exists and can be assigned
84
- const userCheck = await github.rest.users.getByUsername({
84
+ const user = await github.rest.users.getByUsername({
85
85
username: username
86
86
});
87
87
88
- if (userCheck.status === 200 ) {
88
+ if (user.data && user.data.login === username && user.data.type === "Bot" ) {
89
89
assigneeUsername = username;
90
90
console.log(`Found valid assignee: ${username}`);
91
91
break;
92
+ } else if (user){
93
+ console.log(`User ${username} is not a valid assignee - ${user.status}`);
94
+ } else {
95
+ console.log(`API Call failed for ${username} - ${user}`);
92
96
}
93
97
} catch (userError) {
94
98
console.log(`User ${username} not found or not available: ${userError.message}`);
@@ -104,6 +108,8 @@ jobs:
104
108
issue_number: issueOrPR.number,
105
109
assignees: [assigneeUsername]
106
110
});
111
+
112
+ console.log(`AssignResult: ${assignResult.status}`);
107
113
108
114
// Verify assignment was successful by checking the response
109
115
if (assignResult.status === 201 && assignResult.data.assignees.some(a => a.login === assigneeUsername)) {
@@ -139,8 +145,7 @@ jobs:
139
145
repo: context.repo.repo,
140
146
issue_number: issueOrPR.number,
141
147
body: '**Action Required**: Unable to directly assign GitHub Copilot to this task.\n\n' +
142
- 'This issue has been labeled with `needs-copilot-attention` for review by the team.\n\n' +
143
- 'To request GitHub Copilot assistance, please notify an administrator.'
148
+ 'This issue has been labeled with `needs-copilot-attention` for review by the team.'
144
149
});
145
150
146
151
console.log(`Added 'needs-copilot-attention' label to ${context.repo.owner}/${context.repo.repo}#${issueOrPR.number}`); } catch (error) {
0 commit comments