Skip to content

Commit 1ea7f65

Browse files
committed
chore: fix external converter/new device support bot
1 parent 961265a commit 1ea7f65

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

.github/workflows/new_device_external_converter_bot.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -96,35 +96,35 @@ jobs:
9696
return;
9797
}
9898
}
99-
}
100-
101-
// Check if zigbee model is already supported.
102-
const zigbeeModelRe = /zigbeeModel: \[['"](.+)['"]\]/g;
103-
const zigbeeModels = Array.from(issue.body.matchAll(zigbeeModelRe), m => m[1]);
104-
if (zigbeeModels.length > 0) {
105-
for (const zigbeeModel of zigbeeModels) {
106-
const fullMatch = (() => { try { return execSync(`grep -r --include="*.ts" '"${zigbeeModel}"' zhc`, {encoding: 'utf8'}); } catch { return undefined; } })();
107-
if (fullMatch) {
108-
await github.rest.issues.createComment({
109-
owner: context.repo.owner,
110-
repo: context.repo.repo,
111-
issue_number: issue.number,
112-
body: [
113-
`👋 Hi there! The device with zigbee model \`${zigbeeModel}\` is already supported in the latest dev branch.`,
114-
"See this [guide](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) on how to update, after updating you can remove your external converter.",
115-
"",
116-
"In case you created the external converter with the goal to extend or fix an issue with the out-of-the-box support, please submit a pull request.",
117-
"For instructions on how to create a pull request see the [docs](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_4-create-a-pull-request).",
118-
"If you need help with the process, feel free to ask here and we'll be happy to assist."
119-
].join('\n')
120-
});
121-
await github.rest.issues.update({
122-
owner: context.repo.owner,
123-
repo: context.repo.repo,
124-
issue_number: issue.number,
125-
state: "closed",
126-
});
127-
return;
99+
} else {
100+
// Check if zigbee model is already supported.
101+
const zigbeeModelRe = /zigbeeModel: \[['"](.+)['"]\]/g;
102+
const zigbeeModels = Array.from(issue.body.matchAll(zigbeeModelRe), m => m[1]);
103+
if (zigbeeModels.length > 0) {
104+
for (const zigbeeModel of zigbeeModels) {
105+
const fullMatch = (() => { try { return execSync(`grep -r --include="*.ts" '"${zigbeeModel}"' zhc`, {encoding: 'utf8'}); } catch { return undefined; } })();
106+
if (fullMatch) {
107+
await github.rest.issues.createComment({
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
issue_number: issue.number,
111+
body: [
112+
`👋 Hi there! The device with zigbee model \`${zigbeeModel}\` is already supported in the latest dev branch.`,
113+
"See this [guide](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) on how to update, after updating you can remove your external converter.",
114+
"",
115+
"In case you created the external converter with the goal to extend or fix an issue with the out-of-the-box support, please submit a pull request.",
116+
"For instructions on how to create a pull request see the [docs](https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_4-create-a-pull-request).",
117+
"If you need help with the process, feel free to ask here and we'll be happy to assist."
118+
].join('\n')
119+
});
120+
await github.rest.issues.update({
121+
owner: context.repo.owner,
122+
repo: context.repo.repo,
123+
issue_number: issue.number,
124+
state: "closed",
125+
});
126+
return;
127+
}
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)