@docupace/pipeline 1.0.61-alpha.0 → 1.0.61-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.61-alpha.0",
3
+ "version": "1.0.61-alpha.1",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -179,6 +179,21 @@ async function createAndCommitChangeset(
179
179
  /**
180
180
  * Merge into target branch
181
181
  */
182
+
183
+ function branchExists(branchName) {
184
+ try {
185
+ // This will list branches that match the name
186
+ const result = execSync(`git branch --list ${branchName}`, {
187
+ encoding: 'utf8',
188
+ });
189
+ return result.trim().length > 0;
190
+ } catch (error) {
191
+ // If git fails, you can log or handle differently
192
+ console.error('Error checking branch:', error.message);
193
+ return false;
194
+ }
195
+ }
196
+
182
197
  function mergeIntoTarget(
183
198
  sourceBranch,
184
199
  targetBranch,
@@ -192,20 +207,23 @@ function mergeIntoTarget(
192
207
  stdio: verbose ? 'inherit' : 'pipe',
193
208
  });
194
209
 
195
- execSync(`git merge ${mergeBranchName}`, {
196
- stdio: verbose ? 'inherit' : 'pipe',
197
- });
210
+ if (branchExists(mergeBranchName)) {
211
+ execSync(`git merge ${mergeBranchName}`, {
212
+ stdio: verbose ? 'inherit' : 'pipe',
213
+ });
198
214
 
199
- execSync(`git push origin ${targetBranch}`, {
200
- stdio: verbose ? 'inherit' : 'pipe',
201
- });
215
+ execSync(`git push origin ${targetBranch}`, {
216
+ stdio: verbose ? 'inherit' : 'pipe',
217
+ });
202
218
 
203
- // Clean up merge branch
204
- execSync(`git branch -d ${mergeBranchName}`, {
205
- stdio: verbose ? 'inherit' : 'pipe',
206
- });
219
+ execSync(`git branch -d ${mergeBranchName}`, {
220
+ stdio: verbose ? 'inherit' : 'pipe',
221
+ });
207
222
 
208
- if (verbose) console.log(`✅ Successfully merged into ${targetBranch}`);
223
+ if (verbose) console.log(`✅ Successfully merged into ${targetBranch}`);
224
+ } else {
225
+ if (verbose) console.log(`✅ Nothing to merge`);
226
+ }
209
227
  }
210
228
 
211
229
  /**