@beyondwork/wb-cli 0.1.2 → 0.1.4-pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/cli.js +22 -22
- package/package.json +1 -1
package/out/cli.js
CHANGED
|
@@ -211,28 +211,28 @@ commander_1.program
|
|
|
211
211
|
const remoteUrl = (0, child_process_1.execSync)('git remote get-url origin', { cwd: workspaceAbsPath, encoding: 'utf8' }).trim();
|
|
212
212
|
logger.log(`Git remote origin URL: ${remoteUrl}`);
|
|
213
213
|
// Regex to capture owner and repo from https or git@github.com URLs
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
214
|
+
const parts = remoteUrl.split('/');
|
|
215
|
+
if (parts.length < 2) {
|
|
216
216
|
logger.log(`Could not parse owner/repo from git remote URL: '${remoteUrl}'. Skipping PR interaction.`);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const repoNameWithGit = parts[parts.length - 1];
|
|
220
|
+
prRepoName = repoNameWithGit.endsWith('.git') ? repoNameWithGit.slice(0, -4) : repoNameWithGit;
|
|
221
|
+
prRepoOwner = parts[parts.length - 2];
|
|
222
|
+
logger.log(`Inferred repository: ${prRepoOwner}/${prRepoName}`);
|
|
223
|
+
const { data: prsAssociatedWithCommit } = await octokitInstance.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
224
|
+
owner: prRepoOwner,
|
|
225
|
+
repo: prRepoName,
|
|
226
|
+
commit_sha: commitSha,
|
|
227
|
+
});
|
|
228
|
+
if (prsAssociatedWithCommit.length > 0) {
|
|
229
|
+
const openPr = prsAssociatedWithCommit.find(pr => pr.state === 'open');
|
|
230
|
+
const selectedPr = openPr || prsAssociatedWithCommit[0]; // Prefer open PR, fallback to the first one
|
|
231
|
+
prNumberForComment = selectedPr.number;
|
|
232
|
+
logger.log(`Found PR #${prNumberForComment} (state: ${selectedPr.state}) associated with commit ${commitSha} in ${prRepoOwner}/${prRepoName}.`);
|
|
217
233
|
}
|
|
218
234
|
else {
|
|
219
|
-
|
|
220
|
-
prRepoName = repoMatch[2];
|
|
221
|
-
logger.log(`Inferred repository: ${prRepoOwner}/${prRepoName}`);
|
|
222
|
-
const { data: prsAssociatedWithCommit } = await octokitInstance.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
223
|
-
owner: prRepoOwner,
|
|
224
|
-
repo: prRepoName,
|
|
225
|
-
commit_sha: commitSha,
|
|
226
|
-
});
|
|
227
|
-
if (prsAssociatedWithCommit.length > 0) {
|
|
228
|
-
const openPr = prsAssociatedWithCommit.find(pr => pr.state === 'open');
|
|
229
|
-
const selectedPr = openPr || prsAssociatedWithCommit[0]; // Prefer open PR, fallback to the first one
|
|
230
|
-
prNumberForComment = selectedPr.number;
|
|
231
|
-
logger.log(`Found PR #${prNumberForComment} (state: ${selectedPr.state}) associated with commit ${commitSha} in ${prRepoOwner}/${prRepoName}.`);
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
logger.log(`No PRs found associated with commit ${commitSha} in ${prRepoOwner}/${prRepoName}.`);
|
|
235
|
-
}
|
|
235
|
+
logger.log(`No PRs found associated with commit ${commitSha} in ${prRepoOwner}/${prRepoName}.`);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
catch (e) {
|
|
@@ -260,12 +260,12 @@ commander_1.program
|
|
|
260
260
|
}
|
|
261
261
|
if (prNumberForComment && prRepoOwner && prRepoName && octokitInstance && dirsToProcess.size > 0) { // New condition
|
|
262
262
|
logger.log(`Attempting to comment on PR #${prNumberForComment} in repo ${prRepoOwner}/${prRepoName}`);
|
|
263
|
-
let commentBody = 'The following workblock directories were processed by `wb-cli publish-changed-workblocks
|
|
263
|
+
let commentBody = 'The following workblock directories were processed by `wb-cli publish-changed-workblocks`:\n';
|
|
264
264
|
for (const dir of dirsToProcess) {
|
|
265
|
-
commentBody += `-
|
|
265
|
+
commentBody += `- \`\`\`${dir}\`\`\`\n`; // Using backticks for dirs
|
|
266
266
|
}
|
|
267
267
|
if (anySubmissionFailed) {
|
|
268
|
-
commentBody += '
|
|
268
|
+
commentBody += '\nNote: One or more submissions failed. Check logs for details.';
|
|
269
269
|
}
|
|
270
270
|
try {
|
|
271
271
|
await octokitInstance.rest.issues.createComment({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publisher": "beyondwork",
|
|
4
4
|
"displayName": "Beyond Work",
|
|
5
5
|
"description": "Beyond Work is a tool for managing your work in a way that is easy to use and understand.",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.4-pre1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"vscode": "^1.94.0",
|
|
9
9
|
"node": ">=16.0.0"
|