Skip to content

Commit 1e1d73f

Browse files
committed
Add NODE_PATH for yaml module
1 parent 76a6e1a commit 1e1d73f

File tree

3 files changed

+6
-89
lines changed

3 files changed

+6
-89
lines changed

.github/package-lock.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/package.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/assign-issue-owners.yml

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,62 +21,15 @@ jobs:
2121

2222
- name: Setup Node.js
2323
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
24+
with:
25+
cache: npm
26+
cache-dependency-path: .github/scripts/package-lock.json
2427

25-
- name: Install yaml dependency used below
28+
- name: Install dependencies
2629
run: npm ci
27-
working-directory: .github
30+
working-directory: .github/scripts
2831

2932
- name: Parse component label and assign owners
3033
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3134
with:
32-
script: |
33-
const fs = require('fs');
34-
const { parse } = require('yaml');
35-
36-
// Extract component name from label
37-
const labelName = context.payload.label.name;
38-
39-
if (!labelName.startsWith('component:')) {
40-
core.setFailed('Label does not match expected pattern');
41-
return;
42-
}
43-
44-
const componentName = labelName.replace('component:', '');
45-
console.log(`Processing component: ${componentName}`);
46-
47-
// Read and parse component_owners.yml
48-
const yamlContent = fs.readFileSync('.github/component_owners.yml', 'utf8');
49-
const data = parse(yamlContent);
50-
51-
if (!data || !data.components) {
52-
core.setFailed('Invalid component_owners.yml structure');
53-
return;
54-
}
55-
56-
const components = data.components;
57-
58-
if (!(componentName in components)) {
59-
core.setFailed(`Component '${componentName}' not found in component_owners.yml`);
60-
return;
61-
}
62-
63-
const owners = components[componentName];
64-
65-
if (!owners || owners.length === 0) {
66-
core.setFailed(`No owners found for component '${componentName}'`);
67-
return;
68-
}
69-
70-
console.log(`Found owners: ${owners.join(', ')}`);
71-
72-
// Assign the issue to the owners
73-
const issueNumber = context.payload.issue.number;
74-
75-
await github.rest.issues.addAssignees({
76-
owner: context.repo.owner,
77-
repo: context.repo.repo,
78-
issue_number: issueNumber,
79-
assignees: owners
80-
});
81-
82-
console.log(`Successfully assigned issue #${issueNumber} to ${owners.join(', ')}`);
35+
script-path: .github/scripts/assign-issue-owners.js

0 commit comments

Comments
 (0)