pipecraft 0.47.8 → 0.47.10

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.
@@ -12,7 +12,8 @@ import type { PipecraftConfig } from '../../types/index.js';
12
12
  /**
13
13
  * Generates the create-release composite action YAML content.
14
14
  *
15
- * @param {any} ctx - Context (not currently used)
15
+ * @param {any} ctx - Context carrying the resolved config. The generator spreads
16
+ * `ctx.config` over the top level before rendering, so both shapes are read.
16
17
  * @returns {string} YAML content for the composite action
17
18
  */
18
19
  export declare const releaseActionTemplate: (ctx: any) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"create-release.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,KAAK,GAAG,WA4I7C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
1
+ {"version":3,"file":"create-release.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAKlF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,KAAK,GAAG,WAyJ7C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;CAAE,iBAgB/E,CAAA"}
@@ -15,10 +15,16 @@ import { getActionOutputDir, shouldGenerateActions } from '../../utils/action-re
15
15
  /**
16
16
  * Generates the create-release composite action YAML content.
17
17
  *
18
- * @param {any} ctx - Context (not currently used)
18
+ * @param {any} ctx - Context carrying the resolved config. The generator spreads
19
+ * `ctx.config` over the top level before rendering, so both shapes are read.
19
20
  * @returns {string} YAML content for the composite action
20
21
  */
21
22
  export const releaseActionTemplate = (ctx) => {
23
+ // The publish dispatch needs a ref that exists. Hardcoding 'main' made `gh workflow run`
24
+ // answer "could not find any ref" on any repo whose final branch is named something else
25
+ // (examples/gated ends at 'production'), and the dispatch's else branch swallowed that as
26
+ // a warning — so nothing published and nothing went red.
27
+ const finalBranch = ctx?.config?.finalBranch || ctx?.finalBranch || 'main';
22
28
  return dedent `name: 'Create Release'
23
29
  description: 'Create a GitHub release with auto-generated release notes'
24
30
  author: 'PipeCraft'
@@ -101,7 +107,13 @@ export const releaseActionTemplate = (ctx) => {
101
107
 
102
108
  if [ $RELEASE_EXIT_CODE -eq 0 ]; then
103
109
  # Extract release URL from output
104
- RELEASE_URL=$(echo "$RELEASE_OUTPUT" | grep -oE 'https://github.com/.*/releases/.*')
110
+ # Guarded for the same reason the idempotent branch below guards its lookups:
111
+ # this runs under 'bash -eo pipefail', so a grep that matches nothing
112
+ # (a GitHub Enterprise host, say) would fail the assignment and abort the step
113
+ # before release_created=true is written. Every later re-run then takes the
114
+ # "already exists" branch, which writes release_created=false, and that version
115
+ # never dispatches publish. An unmatched URL leaves RELEASE_URL empty instead.
116
+ RELEASE_URL=$(echo "$RELEASE_OUTPUT" | grep -oE 'https://github.com/.*/releases/.*' || echo "")
105
117
  echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
106
118
 
107
119
  # Get release ID using gh api
@@ -145,10 +157,11 @@ export const releaseActionTemplate = (ctx) => {
145
157
  if [ -f ".github/workflows/$PUBLISH_WORKFLOW" ]; then
146
158
  echo "🔄 Triggering $PUBLISH_WORKFLOW for $VERSION"
147
159
 
148
- # Trigger the publish workflow with the release tag on main branch
149
- # This is necessary because GITHUB_TOKEN release creation doesn't trigger workflows
150
- # Explicitly use --ref main to ensure it runs on main, not the default branch (develop)
151
- if gh workflow run "$PUBLISH_WORKFLOW" --ref main --field tag="$VERSION" 2>&1; then
160
+ # Trigger the publish workflow with the release tag on the final branch.
161
+ # This is necessary because GITHUB_TOKEN release creation doesn't trigger workflows.
162
+ # The ref is explicit so the dispatch lands on '${finalBranch}', not on the
163
+ # repository's default branch.
164
+ if gh workflow run "$PUBLISH_WORKFLOW" --ref ${finalBranch} --field tag="$VERSION" 2>&1; then
152
165
  echo "✅ Publish workflow triggered for $VERSION"
153
166
  else
154
167
  echo "⚠️ Failed to trigger publish workflow, but continuing"
@@ -1 +1 @@
1
- {"version":3,"file":"create-release.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/actions/create-release.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAClF,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAG3F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAE,EAAE;IAChD,OAAO,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA0IA,CAAA;AACf,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MA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"}
@@ -1 +1 @@
1
- {"version":3,"file":"enforce-pr-target.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAMlF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,4CAA4C,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,iBAiGxC,CAAA"}
1
+ {"version":3,"file":"enforce-pr-target.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAMlF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,4CAA4C,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,iBAsGxC,CAAA"}
@@ -106,14 +106,19 @@ jobs:
106
106
  # The usual hazard of pull_request_target is running a fork's code with a write token. This
107
107
  # job checks out nothing and runs nothing from the pull request; it reads two ref names and
108
108
  # echoes. 'permissions: {}' removes the token as well, so there is nothing left to misuse.
109
+ #
110
+ # No 'branches:' filter. That filter matches on the pull request's base, so scoping it to
111
+ # '${finalBranch}' made github.base_ref always '${finalBranch}' inside a run: the reject step
112
+ # fired every time and the confirm step below could never run. Worse, a contributor who
113
+ # followed the rejection text and retargeted the PR to '${initialBranch}' produced an
114
+ # 'edited' event the filter excluded, so no new run started and the failed 'check-pr-target'
115
+ # remained the latest status on that head SHA — unmergeable where branch protection requires
116
+ # it. The filter was there to keep promotion PRs from opening approval-gated runs; the
117
+ # pull_request_target trigger has no approval gate, and the pipecraft-promote guard on the
118
+ # job below is what skips those PRs now.
109
119
  on:
110
120
  pull_request_target:
111
121
  types: [opened, edited, synchronize, reopened]
112
- # Only PRs targeting the final branch matter here (the rule rejects human PRs to it).
113
- # Scoping the trigger keeps PipeCraft's own promotion PRs to intermediate branches from
114
- # spawning runs at all; the job-level guard below covers the hop that does target it.
115
- branches:
116
- - ${finalBranch}
117
122
 
118
123
  permissions: {}
119
124
 
@@ -1 +1 @@
1
- {"version":3,"file":"enforce-pr-target.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAErE,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yCAAyC,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAkB,EAAE,EAAE,CAC7C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,cAAc,CACZ,CAAC,GAAQ,EAAE,EAAE;IACX,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,GAAG,CAAA;IAE/D,qFAAqF;IACrF,qFAAqF;IACrF,kEAAkE;IAClE,EAAE;IACF,sFAAsF;IACtF,sFAAsF;IACtF,oFAAoF;IACpF,6EAA6E;IAC7E,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,GAAG,cAAc;;;;;;;;;;6BAUL,WAAW;;UAE9B,WAAW;;;;;;;;;;0CAUqB,aAAa;uCAChB,aAAa;CACnD,CAAA;IACO,CAAC;IAED,OAAO,GAAG,cAAc;;;;iCAIC,WAAW;;;;;;;;;;;;;;UAclC,WAAW;;;;;;;;;;;;kCAYa,WAAW;;sDAES,aAAa,kBAAkB,WAAW;6DACnC,aAAa;;;;;8CAK5B,WAAW,SAAS,aAAa;;;;kCAI7C,aAAa;;0CAEL,aAAa;CACtD,CAAA;AACK,CAAC,EACD,MAAM,CAAC,sBAAsB,CAAC;AAC9B,oFAAoF;AACpF,gFAAgF;AAChF,oFAAoF;AACpF,+EAA+E;AAC/E,sCAAsC;AACtC,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CAAA"}
1
+ {"version":3,"file":"enforce-pr-target.yml.tpl.js","sourceRoot":"","sources":["../../../src/templates/workflows/enforce-pr-target.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAElF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAErE,MAAM,cAAc,GAAG,kBAAkB,CAAC,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yCAAyC,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAkB,EAAE,EAAE,CAC7C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CACvB,cAAc,CACZ,CAAC,GAAQ,EAAE,EAAE;IACX,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,GAAG,GAAG,CAAA;IAE/D,qFAAqF;IACrF,qFAAqF;IACrF,kEAAkE;IAClE,EAAE;IACF,sFAAsF;IACtF,sFAAsF;IACtF,oFAAoF;IACpF,6EAA6E;IAC7E,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,GAAG,cAAc;;;;;;;;;;6BAUL,WAAW;;UAE9B,WAAW;;;;;;;;;;0CAUqB,aAAa;uCAChB,aAAa;CACnD,CAAA;IACO,CAAC;IAED,OAAO,GAAG,cAAc;;;;iCAIC,WAAW;;;;;;;;;KASvC,WAAW,kCAAkC,WAAW;;0DAEH,aAAa;;;;;;;;;;;;;;;;;;;;kCAoBrC,WAAW;;sDAES,aAAa,kBAAkB,WAAW;6DACnC,aAAa;;;;;8CAK5B,WAAW,SAAS,aAAa;;;;kCAI7C,aAAa;;0CAEL,aAAa;CACtD,CAAA;AACK,CAAC,EACD,MAAM,CAAC,sBAAsB,CAAC;AAC9B,oFAAoF;AACpF,gFAAgF;AAChF,oFAAoF;AACpF,+EAA+E;AAC/E,sCAAsC;AACtC,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipecraft",
3
- "version": "0.47.8",
3
+ "version": "0.47.10",
4
4
  "description": "Automated CI/CD pipeline generator for trunk-based development. Generates intelligent GitHub Actions workflows with domain-based change detection, semantic versioning, and branch flow management. Full documentation: https://pipecraft.thecraftlab.dev",
5
5
  "license": "MIT",
6
6
  "type": "module",