Skip to content

Conversation

@samzong
Copy link
Contributor

@samzong samzong commented Dec 2, 2025

FILL IN THE PR DESCRIPTION HERE

FIX #754 (link existing issues this PR will resolve)

owner-notification often go wrong, I think we can switch to use pulls.listFiles via github-script for get Changed Files.

  • Fork-safe: no refs/heads/<head_ref> lookups, so fork PRs stop 404’ing.
  • Safer on pull_request_target: we don’t fetch/run forked code.
  • Simpler and steadier: one API call, fewer knobs; uses GitHub’s own file list, so it ignores branch deletions/force-pushes.
  • Faster and cleaner logs: no extra fetch/diff work.

I create an test script working on my local, It's worked.

~/git/semantic-router (fix/owner-notification-error-2) node local_owner_notification.js .github/workflows/owner-notification.yml
Changed files: [ '.github/workflows/owner-notification.yml' ]
Assignees: [ 'rootfs', 'Xunzhuo' ]
Comment Preview:

## 👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

### 📁 `Root Directory`
**Owners:** @rootfs, @Xunzhuo
**Files changed:**
- `.github/workflows/owner-notification.yml`

---
<div align="center">
<img src="https://raw.githubusercontent.com/vllm-project/semantic-router/main/website/static/img/repo.png" alt="vLLM" width="80%"/></div>

## 🎉 Thanks for your contributions!

*This comment was automatically generated based on the OWNER files in the repository.*

If u want know more about this script.

View local_owner_notification.js
const fs = require('fs');
const path = require('path');
const cp = require('child_process');

function getChangedFiles() {
  const args = process.argv.slice(2);
  if (args.length > 0) return args;
  try {
    const out = cp.execSync('git diff --name-only HEAD --', { encoding: 'utf8' }).trim();
    if (out) return out.split('\n').filter(Boolean);
  } catch (_) {}
  try {
    const out = cp.execSync('git ls-files -m', { encoding: 'utf8' }).trim();
    if (out) return out.split('\n').filter(Boolean);
  } catch (_) {}
  return [];
}

function findOwnerFile(filePath) {
  const parts = filePath.split('/');
  if (parts.length > 1) {
    const firstLevelDir = parts[0];
    const ownerPath = path.join(firstLevelDir, 'OWNER');
    if (fs.existsSync(ownerPath)) {
      const content = fs.readFileSync(ownerPath, 'utf8');
      const owners = content.split('\n').filter(line => line.trim().startsWith('@')).map(line => line.trim());
      if (owners.length > 0) return { path: firstLevelDir, owners };
    }
  }
  if (fs.existsSync('OWNER')) {
    const content = fs.readFileSync('OWNER', 'utf8');
    const owners = content.split('\n').filter(line => line.trim().startsWith('@')).map(line => line.trim());
    if (owners.length > 0) return { path: '.', owners };
  }
  return null;
}

function buildOwnerMap(changedFiles) {
  const ownerMap = new Map();
  for (const file of changedFiles) {
    if (!file.trim()) continue;
    const info = findOwnerFile(file);
    if (!info) continue;
    if (!ownerMap.has(info.path)) ownerMap.set(info.path, { owners: info.owners, files: [] });
    ownerMap.get(info.path).files.push(file);
  }
  return ownerMap;
}

function buildAssignees(ownerMap) {
  const all = new Set();
  for (const [, info] of ownerMap) for (const owner of info.owners) all.add(owner.replace('@', ''));
  return Array.from(all);
}

function buildComment(ownerMap) {
  let body = '## 👥 vLLM Semantic Team Notification\n\n';
  body += 'The following members have been identified for the changed files in this PR and have been automatically assigned:\n\n';
  for (const [dirPath, info] of ownerMap) {
    body += `### 📁 \`${dirPath === '.' ? 'Root Directory' : dirPath}\`\n`;
    body += `**Owners:** ${info.owners.join(', ')}\n`;
    body += `**Files changed:**\n`;
    for (const f of info.files) body += `- \`${f}\`\n`;
    body += '\n';
  }
  body += '---\n';
  body += '<div align="center">\n';
  body += '<img src="https://raw.githubusercontent.com/vllm-project/semantic-router/main/website/static/img/repo.png" alt="vLLM" width="80%"/>';
  body += '</div>\n\n';
  body += '## 🎉 Thanks for your contributions!\n\n';
  body += '*This comment was automatically generated based on the OWNER files in the repository.*';
  return body;
}

function main() {
  const changed = getChangedFiles();
  console.log('Changed files:', changed);
  const ownerMap = buildOwnerMap(changed);
  if (ownerMap.size === 0) {
    console.log('No owners found for changed files');
    process.exit(0);
  }
  const assignees = buildAssignees(ownerMap);
  console.log('Assignees:', assignees);
  const comment = buildComment(ownerMap);
  console.log('Comment Preview:\n');
  console.log(comment);
}

main();

  • Make sure the code changes pass the pre-commit checks.
  • Sign-off your commit by using -s when doing git commit
  • Try to classify PRs for easy understanding of the type of changes, such as [Bugfix], [Feat], and [CI].
Detailed Checklist (Click to Expand)

Thank you for your contribution to semantic-router! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Feat] for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).
  • [Router] for changes to the vllm_router (e.g., routing algorithm, router observability, etc.).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • Pass all linter checks. Please use pre-commit to format your code. See README.md for installation.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Please include sufficient tests to ensure the change is stay correct and robust. This includes both unit tests and integration tests.

DCO and Signed-off-by

When contributing changes to this project, you must agree to the DCO. Commits must include a Signed-off-by: header which certifies agreement with the terms of the DCO.

Using -s with git commit will automatically add this header.

What to Expect for the Reviews

@netlify
Copy link

netlify bot commented Dec 2, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit a3a9ea8
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/692eada796d30300086b4f46
😎 Deploy Preview https://deploy-preview-756--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@samzong samzong force-pushed the fix/owner-notification-error-2 branch from 11d719e to 98834da Compare December 2, 2025 08:58
@samzong samzong force-pushed the fix/owner-notification-error-2 branch from 98834da to a3a9ea8 Compare December 2, 2025 09:13
@samzong
Copy link
Contributor Author

samzong commented Dec 2, 2025

@Xunzhuo @rootfs It's PR want fix Owner Notification workflow error.

and i sync this workflow to another repo, It's already work.

@Xunzhuo Xunzhuo merged commit 327d0f1 into vllm-project:main Dec 2, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: owner notification: changed-files step fails on pull_request_target (fork PRs)

2 participants