Skip to content

[Nexthop] [fboss2] Move delete interface commands to fboss2-config lib #949

[Nexthop] [fboss2] Move delete interface commands to fboss2-config lib

[Nexthop] [fboss2] Move delete interface commands to fboss2-config lib #949

name: Auto Label by Vendor Name
on:
pull_request_target:
types: [opened, edited]
permissions:
pull-requests: write
jobs:
label-by-company:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v9
with:
script: |
const title = context.payload.pull_request.title;
const prNumber = context.issue.number;
const { owner, repo } = context.repo;
// Predefined valid company names (lowercase for matching)
const validCompanies = [
'accton',
'celestica',
'nexthop',
'arista',
'cisco',
'nvidia',
'meta',
];
// Extract company name from first [...]
const match = title.match(/^\[([^\]]+)\]/);
if (!match) {
core.setFailed(
'PR title must start with a company name in brackets, e.g. "[CompanyName] Your PR title". ' +
'This is required for all vendor contributions.'
);
return;
}
const companyName = match[1].trim();
const companyLower = companyName.toLowerCase();
core.info(`Extracted company name: "${companyName}"`);
if (!validCompanies.includes(companyLower)) {
core.warning(`Company name "${companyName}" is not recognized.`);
return;
}
await github.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels: [companyLower]
});
core.info(`Added label: "${companyLower}"`);