File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1010 permissions :
1111 contents : read
1212 pull-requests : write
13+ issues : write
1314
1415 steps :
1516 - name : Checkout code
9192 return;
9293 }
9394
95+ // Collect all unique owners for assignment
96+ const allOwners = new Set();
97+ for (const [, info] of ownerMap) {
98+ for (const owner of info.owners) {
99+ // Remove @ prefix for API call
100+ allOwners.add(owner.replace('@', ''));
101+ }
102+ }
103+
104+ // Assign owners to the PR
105+ if (allOwners.size > 0) {
106+ try {
107+ await github.rest.issues.addAssignees({
108+ owner: context.repo.owner,
109+ repo: context.repo.repo,
110+ issue_number: context.issue.number,
111+ assignees: Array.from(allOwners)
112+ });
113+ console.log(`Assigned PR to: ${Array.from(allOwners).join(', ')}`);
114+ } catch (error) {
115+ console.log(`Failed to assign PR: ${error.message}`);
116+ // Continue with comment creation even if assignment fails
117+ }
118+ }
119+
94120 // Create comment content
95121 let commentBody = '## 👥 Owner Notification\n\n';
96- commentBody += 'The following owners have been identified for the changed files in this PR:\n\n';
122+ commentBody += 'The following owners have been identified for the changed files in this PR and have been automatically assigned :\n\n';
97123
98124 for (const [dirPath, info] of ownerMap) {
99125 commentBody += `### 📁 \`${dirPath === '.' ? 'Root Directory' : dirPath}\`\n`;
You can’t perform that action at this time.
0 commit comments