skillsets 0.4.4 → 0.4.6
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/dist/commands/submit.js +18 -1
- package/package.json +1 -1
package/dist/commands/submit.js
CHANGED
|
@@ -251,10 +251,27 @@ _Add any additional context for reviewers here._
|
|
|
251
251
|
---
|
|
252
252
|
Submitted via \`npx skillsets submit\`
|
|
253
253
|
`;
|
|
254
|
-
|
|
254
|
+
// Check if PR already exists for this branch
|
|
255
|
+
const existingPr = spawnSync('gh', ['pr', 'list', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--json', 'url', '--jq', '.[0].url', '--state', 'open', '--limit', '1'], {
|
|
255
256
|
cwd: tempDir,
|
|
256
257
|
encoding: 'utf-8',
|
|
257
258
|
});
|
|
259
|
+
let prResult;
|
|
260
|
+
if (existingPr.status === 0 && existingPr.stdout.trim()) {
|
|
261
|
+
// PR exists — force push already updated it, just edit title/body
|
|
262
|
+
prResult = spawnSync('gh', ['pr', 'edit', '--repo', REGISTRY_REPO, existingPr.stdout.trim(), '--title', prTitle, '--body', prBody], {
|
|
263
|
+
cwd: tempDir,
|
|
264
|
+
encoding: 'utf-8',
|
|
265
|
+
});
|
|
266
|
+
prResult.stdout = existingPr.stdout;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
// Create new PR
|
|
270
|
+
prResult = spawnSync('gh', ['pr', 'create', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--title', prTitle, '--body', prBody], {
|
|
271
|
+
cwd: tempDir,
|
|
272
|
+
encoding: 'utf-8',
|
|
273
|
+
});
|
|
274
|
+
}
|
|
258
275
|
if (prResult.status !== 0) {
|
|
259
276
|
throw new Error(prResult.stderr || 'Failed to create PR');
|
|
260
277
|
}
|