Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/owner-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write

steps:
- name: Checkout code
Expand Down Expand Up @@ -91,9 +92,34 @@ jobs:
return;
}

// Collect all unique owners for assignment
const allOwners = new Set();
for (const [, info] of ownerMap) {
for (const owner of info.owners) {
// Remove @ prefix for API call
allOwners.add(owner.replace('@', ''));
}
}

// Assign owners to the PR
if (allOwners.size > 0) {
try {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: Array.from(allOwners)
});
console.log(`Assigned PR to: ${Array.from(allOwners).join(', ')}`);
} catch (error) {
console.log(`Failed to assign PR: ${error.message}`);
// Continue with comment creation even if assignment fails
}
}

// Create comment content
let commentBody = '## 👥 Owner Notification\n\n';
commentBody += 'The following owners have been identified for the changed files in this PR:\n\n';
commentBody += 'The following owners have been identified for the changed files in this PR and have been automatically assigned:\n\n';

for (const [dirPath, info] of ownerMap) {
commentBody += `### 📁 \`${dirPath === '.' ? 'Root Directory' : dirPath}\`\n`;
Expand Down
Loading