@lonca/baron-recipes 0.4.0 → 0.5.0

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -214,9 +214,11 @@ function interpolate(value, context) {
214
214
  import {
215
215
  BaronError as BaronError2,
216
216
  ISSUE_LINK_TYPES,
217
+ PR_STATE_FILTERS,
217
218
  WORKFLOW_ROLES,
218
219
  WORK_ITEM_TYPE_ROLES,
219
220
  isIssueLinkType,
221
+ isPrStateFilter,
220
222
  isWorkItemTypeRole,
221
223
  isWorkflowRole
222
224
  } from "@lonca/baron-core";
@@ -427,7 +429,17 @@ async function dispatchOp(ports, op, params) {
427
429
  case RECIPE_OPS.scmPrStatus:
428
430
  return scm(ports, op).prStatus(reqStr(params, "pullRequestId", op));
429
431
  case RECIPE_OPS.scmPrFind: {
430
- const found = await scm(ports, op).prForBranch(reqStr(params, "sourceBranch", op));
432
+ const stateFilter = optStr(params, "state", op);
433
+ if (stateFilter !== void 0 && !isPrStateFilter(stateFilter)) {
434
+ throw new BaronError2(
435
+ `Step '${op}' 'state'='${stateFilter}' must be one of ${PR_STATE_FILTERS.join(", ")}.`,
436
+ ARGS
437
+ );
438
+ }
439
+ const found = await scm(ports, op).prForBranch(
440
+ reqStr(params, "sourceBranch", op),
441
+ stateFilter
442
+ );
431
443
  return found ?? null;
432
444
  }
433
445
  case RECIPE_OPS.ciRunTrigger: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lonca/baron-recipes",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -17,13 +17,13 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "yaml": "^2.6.0",
20
- "@lonca/baron-core": "0.4.0",
21
- "@lonca/baron-knowledge-loop": "0.4.0"
20
+ "@lonca/baron-core": "0.5.0",
21
+ "@lonca/baron-knowledge-loop": "0.5.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^22.0.0",
25
- "@lonca/baron-adapter-github": "0.4.0",
26
- "@lonca/baron-conformance": "0.4.0"
25
+ "@lonca/baron-adapter-github": "0.5.0",
26
+ "@lonca/baron-conformance": "0.5.0"
27
27
  },
28
28
  "description": "Baron recipe engine: run declarative YAML workflows over Baron primitives, deterministically.",
29
29
  "keywords": [